[b]Report, comma separated column data[/b]
Hi all
I M using Oracle 7.3 as backend and report 6i as frontend.
I have a table T1 with columns
custno - varchar2(4)
billno - number(3)
The data it contains as
custno billno
a123 100
a123 200
b234 111
b234 222
a123 300
b234 333
z678 765
I want the output in report as follows
custno billno
a123 100,200,300
b234 111,222,333
z678 765
I should mention here that the custno and bill no will keep on growing.
Can anybody help
UMESH
Make a Group Left report using the Report wizard with the group field as CustNo and displayed fields as CustNo and Bill No.
Now,
For the Outermost repeating frame i.e. R_G_CustNo for the group G_CustNo,
Select:
Print Direction :Down
Vertical Elasticity : Variable
Horizontal Elasticity: Fixed
With the other settings as default
Now this repeating frame contains F_CustNo, R_G_BillNo, F_BillNo
For the repeating frame i.e. R_G_ BillNo for the group G_ BillNo,
Select:
Print Direction : Across/Down
Vertical Elasticity : Variable
Horizontal Elasticity: Fixed
With the other settings as default
Please note that in the Paper Layout R_G_CustNo should be stretched horizontally over the whole panel whereas R_G_ BillNo should be just the minimum size required so that it can be repeated over R_G_CustNo horizontally
Swati
Similar Messages
-
SSRS Report : Comma Separated Hyperlinks
Hello,
I want to display Comma Separated Hyperlinks in SSRS Report. I am not sure what should I change here to get this working.
Below is the flow of data.
1. Extracting value from the SharePoint List using SSIS Package Script component and filling data in SQL Table.
I have used this Table and created below view to stuff all these three links together.
SELECT ID, STUFF
((SELECT ', ' + BCM.BCMProgramDocument
FROM BCMProgramDocumentation BCM
WHERE BCM.Risk = R.ID FOR XML PATH('')), 1, 1, '') AS BCMDoc
FROM Risk R
which gives me below output, not sure why.
"<a href='http://yahoo.com'>YAHOO</a>", "<a href='http://gmail.com'>GMAIL</a>", "<a href='http://hotmail.com'>HOTMAIL</a>"
Then in the SSRS Reporting, I have placed a PlaceHolder with HTML View selected and gave above field value in the expression.
They are not appearing as comma separated Hyperlinks.
Can anyone please help me on this ? What are the changes required in above steps ?
Thank you,
Mittal.Hi Mittal,
According to your description, you want to show three links together with comma separated from BCMProgramDocument column to a report table. After testing the issue in my environment, we can refer to the following steps to achieve your requirement:
Use the following query create a dataset:
select * from BCMProgramDocumentation
Click Fields in the left pane, add a Calculated Field as below:
Field Name: ID2 Field Source: 1
Drag a table to design surface, then insert the expression below in the detail row:
=JOIN(lookupset(Fields!ID2.Value,Fields!ID2.Value,Fields!BCMProgramDocument.Value,"DataSet1"),",")
Right-click the Placeholder to open Placeholder Properties, then select ‘HTML-Interpret HTML tags as styles’ as Markup type.
The following screenshot is for your reference:
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Comma Separated columns - Search
Hi fellow,
I need to query my db with a comma separated list but the results are not correct...What is the reason?
My typical db problem_code column has valuas as :
Problem_code
1
2,3
5,6,7,8
5
And the list values I am sending as ("1","3")...etc
SELECT * from table
whereproblem_code in ('2','1')problem_code in ('2','1')
Thank you in advance..If you're sking SQL questions, you'd better off asking on a SQL forum. But here you are, so let's have a look at it.
Firstly, the other thing to always mention when raising an SQL question is to articulate what DB system you're using. Because all of them handle SQL differently, and have their own extensions.
In fact reading this is probably a good idea: http://www.catb.org/~esr/faqs/smart-questions.html
Problem_code
1
2,3
5,6,7,8
5
And the list values I am sending as ("1","3")...etc
SELECT * from table
whereproblem_code in ('2','1')problem_code in ('2','1')
Thank you in advance..
What are you seeing here that's not expected (I presume the double-up of problem_code in ('2','1') is a typo)?
Are you wanting to get any rows from TABLE which have either 1 or 2 in them? That's not what you're asking for in your WHERE statement though, is it?
Really, you should be normalising your data, because whilst you can write contorted logic to do what you need here, it will not perform well and certainly will not scale. So it for be somewhat poor practice to perpetuate the current situation if it's at all possible not to. The best thing to do is to normalise your data and refactor your code. Which will probably mean going to your boss and say "this DB schema is f*cked, and needs reworking. Needs reworking".
Depending on your DB system, you're probably going to need to loop over the list you want to filter on and do a "WHERE problem_code LIKE" on each element of the list. I think Oracle can do the sort of query you want to do - match elements of one list from another list - but I'm not sure.
Adam -
SQL Select with comma separated column value
Hi All
ASP VBScript
I have a DB column named allowed_contracts that stores a
comma separated
list of of values e.g. 3, 5, 19, 44, 52
I need to select records based on a variable called
varContractList that
contains another comma separated list i.e. 5, 44, 52
I only want to select records where the allowed_contracts
column contains
each of the varContractList,
For example only return records that have 5 or 44 or 52 in
thier
allowed_contracts column.
My brain is now in a persistant vegetive state trying to work
this out so
any ideas would be much appreciated.
Regards
BrenHi Jules
Cheers for this.
I was trying to be a bit cute (lazy even) by storing the
project ID's as a
comma delimted string but as we see it doesn't always pay to
be lazy. Serves
me right for destroying brain cells by drinking the Welshpool
beer the other
week whilst visiting mates down that neck of the woods. :-))
Time for another table me thinks.
Rgds
Bren
"Julian Roberts" <[email protected]> wrote in message
news:e7i13f$mup$[email protected]..
> Fatal flaw here Bren. In a relational database, one
shouldn't really store
> foreign keys as a comma delimted string. One should have
a 3 table
> structure. eg
>
> Products:
> ProductID
> Product
>
> Categories:
> CategoryID
> Category
>
> ProductCategories:
> ProductID
> CategoryID
>
> So, from the table ProductCategories, a product can
belong to many
> categories. When doing a front end search to find
products in multiple
> categories, products can be shown thus:
>
> select * from Products where ProductID in (select
ProductID from
> ProductCategories where CategoryID in (5,44))
>
> --
> Jules
>
http://www.charon.co.uk/charoncart
> Charon Cart 3
> Shopping Cart Extension for Dreamweaver MX/MX 2004
>
>
>
>
> -
I have a requirement to take a String column that allows multiple fields i.e. "101;102,103,104",
and using a SPD 2013 workflow I want to split there values and then insert each Values into different list as separate items.
Eg:
I have a LIST A with the columns CustID, CustName and LIST B with the same Column Name with the below values
LIST A:
Cust ID
CustName
101
ABC, XYZ, CTSS, WIPROS, TCSS
I want to insert the above comma separated values in the below format(different Row)
LIST B:
CustID
CustName
101
ABC
101
XYZ
101
CTSS
101
WIPROS
101
TCSSHi,
Here is a codeplex solution can meet your reference:
Plumsail String Workflow Actions for SharePoint 2013 and SharePoint Online
http://spworkflowactions.codeplex.com/
We can use Split string workflow action to split the CustName value, then insert it to ListB.
More information:
http://www.codeproject.com/Articles/749471/String-processing-workflow-actions-for-SharePoint
Best Regards
Dennis Guo
TechNet Community Support -
Comma separated column into rows for each value
experts,
I have a two column table. The second column has comma separated string values. How can I put the values separate for each comma separated and make one row for each value?
example,
column1 | StringColumn
s1 | test, joy, happy
s2 | USA, England, India
I want the result to be like below
column1 | StringColumn
s1 | test
s1 | joy
s1 | happy
s2 | USA
s2 | England
s2 | India
thanks in advance
ebroHello ebro,
See the following for a possible solution:
http://gallery.technet.microsoft.com/scriptcenter/Convert-Small-CSV-Value-to-ffc142ff
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Hi,
This might be a really dumb one to ask but I am currently working on a table that has sequential data for steps that an invoice goes through in a particular system. Here is how it looks:
ID InvoiceID
InvoiceSteps
Timestamp
283403 0000210121_0002_2013
Post FI Invoice
2013-07-01 19:07:00.0000000
389871 0000210121_0002_2013
Clear Invoice
2013-08-25 14:02:00.0000000
Here is my extremely slow query that converts multiple rows of an invoice into a single one with 'InvoiceSteps' listed according to their timestamps in a sequential manner separated by commas.
SELECT [InvoiceID],
[InvoiceSteps] = STUFF((
SELECT ',' + ma.InvoiceSteps
FROM invoices ma
WHERE m.InvoiceID = ma.InvoiceID
ORDER BY [Timestamp]
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '')
FROM invoices m
GROUP BY InvoiceID
ORDER BY InvoiceID;
Here is the end result:
InvoiceID InvoiceSteps
0000210121_0002_2013
Post FI Invoice,Clear Invoice
My question: How can I improve the query so that it can process thousands of records as fast as possible (>600K in this case).
Thanks you!There are many methods to concatenate the rows to columns. Assuming you have necessary indexes to support your query as Rishabh suggested, if you still find issues with performance, then you need to look at various other approaches as well. I have seen at
certain places(huge data), CLR outperformed . Having said, we need to assess each and come to a conclusion for your scenario.
Refer the below link for various approach, (please also look at the comment session as well):
https://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/ -
Splitting comma seperated column data into multiple rows
Hi Gurus,
Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
Below is the example:
Source Data:
Product Size Stock
ABC X,XL,XXL,M,L,S 1,2,3,4,5,6
Target Data:
Product Size Stock
ABC X 1
ABC XL 2
ABC XXL 3
ABC M 4
ABC L 5
ABC S 6
Which transformation we need to use for getting this output?
Thanks in advance !Hello,
Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
Thanks -
Comma separated column values into row values
Hi all,
i am selecting the data from TABLE A ( id number ,rights varchar2 ). result set as
ID RIGHTS
1 M,P,Y,N,C,P
4 N,E,A
10 N,C,R,P
but i want the output as
ID RIGHTS
1 M
1 P
1 Y
1 N
1 C
1 P
4 N
4 E
4 A
10 N
10 C
10 R
10 P
kindly share your idea's to get the desired results.
thanks in advance
Edited by: 887268 on Nov 30, 2012 11:12 PMTry this
SQL> WITH a(id, rights) AS
2 (
3 SELECT 1, 'M,P,Y,N,C,P' FROM dual UNION ALL
4 SELECT 4, 'N,E,A' FROM dual UNION ALL
5 SELECT 10, 'N,C,R,P' FROM dual)
6 SELECT id, regexp_substr(rights, '[^,]+',1,level) res
7 FROM a
8 CONNECT BY level - 1 <= regexp_count(rights,',') /* regexp_count:- 11g */
9 AND prior id = id
10 AND prior sys_guid() IS NOT NULL /* sys_guid:- 11g */
11 ORDER BY id
12 /
ID RES
1 M
1 P
1 Y
1 N
1 C
1 P
4 N
4 A
4 E
10 N
10 R
ID RES
10 C
10 P
13 rows selected.Thanks!
Edited by: Ashu_Neo on Dec 1, 2012 9:43 PM
-- Added comment -
Exporting table data to a Comma Separated file / .dat file?
Hi All,
I want to export the table data to a .CSV or .DAT file. This data is an input to other software to read and load like "Informatica".
I tried spooling the file by providing the extension as .CSV but that did'nt work!
Could you please let me know how can I get the data of a table into a .CSV or .DAT file?
I am trying to get it via SQL Prompt.
Thanks in advance.
HimanshuTake a look to the Laurent Schneider's solution.
Nicolas. -
Flat files data comma separated using SSIS.
Hi,
I have multiple flat files which come in comma separated columns. See example below :
Customer Data
CustID,FName,LName,Disease,Email,Phone
12345,Xyz,Smit,Bronchitis, Asthma and fever,[email protected],80000000
12346,Abc,Doe,fever Headache,[email protected],90000000
12347,Klu,joe,Sugar, cough and fever,[email protected],12345678
Please look at the ID's 12345 and 12347. The disease column has a internal comma space between. How do i remove the comma spaces in the disease column, so that it can be loaded from flat file to sql table using SSIS. ?
Please help !
ThanksHere is a full solution base on my post above (first option)
1. create temp table (Give it a unique name):
create table #T (Txt NVARCHAR(MAX))
GO
2. Insert all the data into temporary table. Each line in the text file, is a value for one column in a row in the table.
-- I will jump to the table and use simple insert.
-- If you have problem with step 1 then please inform us (this is simple bulk insert basically)
insert #T (Txt) values
('1234435,Xyz,Stemit,Brfsdonchitis, Asthma and fever,[email protected],80000000'),
('12346,Agjdfjbc,Doge,fevhhhher Headsxdshhache,[email protected],90000000'),
('123447,Klu,joe,Sugar, cough and fever,[email protected],12345678')
GO
the result should be like this:
Txt
1234435,Xyz,Stemit,Brfsdonchitis, Asthma and fever,[email protected],80000000
12346,Agjdfjbc,Doge,fevhhhher Headsxdshhache,[email protected],90000000
123447,Klu,joe,Sugar, cough and fever,[email protected],12345678
I use a SPLIT Function named Split_CLR_Fn. This is a CLR Split function that get input <string to split> and <string as delimiter,> and it return table with 2 columns ID, SplitData
For example if you use: SELECT * from Split_CLR_Fn('text1,text2,text3,',') then you get result:
ID SplitData
1 Text1
2 Text2
3 Text3
** You can find in the internet several good functions, I HIGHLY RECOMMENDED NOT TO USE T-SQL FUNCTIONS but CLR FUNCTION. Check thi link to understand why:
http://sqlperformance.com/2012/07/t-sql-queries/split-strings
** This is the best function that I know about and I use it, but I change the code a bit to return 2 columns and not just the SplitData as in this blog: http://sqlblog.com/blogs/adam_machanic/archive/2009/04/28/sqlclr-string-splitting-part-2-even-faster-even-more-scalable.aspx
That's it :-) we are ready for the solution which is very simple
Solution 1 (BAD solution but easy to write):
select
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 1) CustID,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 2) FName,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 3) LName,
STUFF((select ',' + SplitData from Split_CLR_Fn(Txt,',') where ID > 3 and ID < (select MAX(ID) from Split_CLR_Fn(Txt,',')) - 1 for XML path('')), 1 , 1,'') Disease,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = (select MAX(ID) from Split_CLR_Fn(Txt,',')) - 1) Email,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = (select MAX(ID) from Split_CLR_Fn(Txt,','))) Phone
from #T
GO
Solution 2: better in this case since the format is constant (this is the solution I wrote about above)
;With MyCTE as (
select
Txt,
SUBSTRING(Txt, 1, CHARINDEX(',', Txt, 1) - 1) as CustID
, SUBSTRING(
Txt
,CHARINDEX(',', Txt, 1) + 1 -- I start from the end of preview len
, CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)- CHARINDEX(',', Txt, 1) - 1
) as FName
, SUBSTRING(
Txt
,CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)+1 -- I start from the end of preview len
, CHARINDEX(',', Txt, CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)+1) - CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1) - 1
) as LName
, RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1) as Phone
, RIGHT(LEFT(Txt, Len(Txt) - Len(RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1)) - 1), CHARINDEX(',', REVERSE(LEFT(Txt, Len(Txt) - Len(RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1)) - 1)), 1) - 1) as Email
from #T
select CustID,FName,LName, Phone, Email, SUBSTRING(Txt, Len(CustID) + Len(FName) + Len(LName) + 4, Len(Txt) - Len(Email) - LEN(Phone) - Len(CustID) - Len(FName) - Len(LName) - 5) as Disease
from MyCTE
I hope that this is useful :-)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
Query on column with comma separated values
I have a proposed table with unnormalized data like the following:
ID COLA COLB REFLIST
21 xxx zzz 24,25,78,412
22 xxx xxx 21
24 yyy xxx 912,22
25 zzz fff 433,555,22
.. ... ... ...There are 200 million rows. There is maximum of about 10 IDs in the REFLIST, though typically two or three. How could I efficiently query this data on the REFLIST column? e.g. something like:
SELECT id FROM mytable WHERE :myval in reflistLogically there is a many to many relationship between rows in this table. The REFLIST column contains pointers to ID values elsewhere in the table. The data could be normalized so that the relationship keys are in a separate table (in fact this is the current solution that we want to change).
ID REF
21 24
21 25
21 78
21 412
22 21
24 912
... ...The comma separated list seems instinctively like a bad idea, however there are various reasons for proposing it. The main reason is because the source for this data has it structured like the REFLIST example. It is an OLTP-like system rather than a data warehouse. The source code (and edit performance) would benefit greatly from not having to maintain the relationship table as the data changes.
Going back to querying the REFLIST column, the problem seems to be building an approriate index for the data. The ideas proposed so far are:
<li>Make a materialized view that presents the relationships as normalized (e.g. as in the example with ID, REF columns above), then index the plain column - the various methods of writing the view SQL have been widely posted.
<li>Use a Oracle Text Index (not something I have ever had call to use before).
Any other ideas? Its Oracle 10.2, though 11g could be possible.
Thanks
JimSomething like this ?
This is test demo on my 11.2.0.1 Windows XP
SQL> create table test (id number,reflist varchar2(30));
Table created.
SQL> insert into test values (21,'24,25,78,412');
1 row created.
SQL> insert into test values (22,'21');
1 row created.
SQL> insert into test values (24,'912,22');
1 row created.
SQL> insert into test values (25,'433,555,22');
1 row created.
SQL> select * from test
2 where
3 ',' || reflist || ',' like '%,22,%';
ID REFLIST
24 912,22
25 433,555,22
SQL>Source:http://stackoverflow.com/questions/7212282/is-it-possible-to-query-a-comma-separated-column-for-a-specific-value
Regards
Girish Sharma
Edited by: Girish Sharma on Jul 12, 2012 2:31 PM -
Need to Convert Comma separated data in a column into individual rows from
Hi,
I need to Convert Comma separated data in a column into individual rows from a table.
Eg: JOB1 SMITH,ALLEN,WARD,JONES
OUTPUT required ;-
JOB1 SMITH
JOB1 ALLEN
JOB1 WARD
JOB1 JONES
Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
But I need to use a database independent solution
Thanks in advance for your valuable inputs.
GeorgeGo for ETL solution. There are couple of ways to implement.
If helps mark -
When I import a text file(comma separated) into a numbers spreadsheet all the data goes into one column instead of individual columns based on the comma separators. Excel allows you to do this during the import.. Is there a way to accomplish this in numbers without opening it in Excel and the importing into Numbers.
Your user info says iPad. This is the OS X Numbers forum. Assuming you are using OS X… Be sure the file is named with a .csv suffix.
(I don't have an iPad, so I don't know the iOS answer.) -
One column having multiple values with comma separator.
Hey Guys,
In my db, one culmn having multiple values with comma separator. like column_name = 'value1,value2,value3'. Now I want to compare this column to another column and fetch in Cursor.
and each value having corresponding email_id, By fetching cursor, I need to populate email_ids.
Thanks in advance!!
-LakshmanPlease compare and fetch cursor and populate result with out extract data into temp table. Give me the query!You have not provided DDL for table so I don't know table or column name to write any SQL.
You have not provided DML for test data to run SQL against.
Maybe you are looking for
-
How to dequeue/delete/remove a message with delay?
I've enqueued a message with dbms_aq.enqueue using l_message_properties.delay := 24*60*60*x where x is calculated so that the message should normally be dequeued on a given date, but not before next midnight. So that if nothing happens, the message c
-
Installed Yosemite 10.9.5 and now screen is frozen. Cannot restart or shut down. Have done Repair Permissions but still not working.
-
Instr.lib or user.lib?
Hi, I want to publish some professional LV drivers for our hardware. Intuitively, I supposed that the right installation folder would be "instr.lib". Nevertheless, the NI Driver and VI Library Development Guidelines" (http://zone.ni.com/devzone/cda/t
-
Hi, was wondering if there is a way to recover deleted photos?
@
-
5G iPod and XtremeMac Micromemo
Another question, folks, I am considering a personal recorder device for my fifth generation iPod. Here's the deal, I cover the hockey team at my college for the radio broadcasts, and for the school paper. I want to keep all my music synched to my de