Crystal report; Combining rows of data into a single value
Crystal report; Combining rows of data into a single value or
Concatenate Column Values from Multiple Rows into a Single Column
I have two field like this
field1 field2
1 a@xyz.com
2 b@xyz.com
3 c@xyz.com
4 d@xyz.com
I wanted output like:
a@xyz.com , b@xyz.com, c@xyz.com, d@xyz.com
Solution
In Report header put a formula @initializeVar which will work as global variable:
WhilePrintingRecords;
StringVar Conc_emailID := "";
In Group Header or Detail Section (Wherever u want) put a formula @updateVar to concatenate the cell value of each row:
WhilePrintingRecords;
StringVar Conc_emailID := Conc_emailID + {tablename.field2}+ ',' ;
In Report Footer finally access the concatenated value from variable by putting a formula field @showVar :
WhilePrintingRecords;
StringVar Conc_emailID;
It will give you the desired output.
- Vinod Kotiya
Concatenate Column Values from Multiple Rows into a Single Column
I have two field like this
field1 field2
1 a@xyz.com
2 b@xyz.com
3 c@xyz.com
4 d@xyz.com
I wanted output like:
a@xyz.com , b@xyz.com, c@xyz.com, d@xyz.com
Solution
In Report header put a formula @initializeVar which will work as global variable:
WhilePrintingRecords;
StringVar Conc_emailID := "";
In Group Header or Detail Section (Wherever u want) put a formula @updateVar to concatenate the cell value of each row:
WhilePrintingRecords;
StringVar Conc_emailID := Conc_emailID + {tablename.field2}+ ',' ;
In Report Footer finally access the concatenated value from variable by putting a formula field @showVar :
WhilePrintingRecords;
StringVar Conc_emailID;
It will give you the desired output.
- Vinod Kotiya
Comments
- this is work with group but i have not group in report