how do i get multiple rows output as comma separated items on one line?
how do i get multiple rows output as comma separated items on one line?
Hi,
I was after some help getting something like this working....
If I have the following tables....
Parent
^^^^^
int Id
string ParentName
Child
^^^
int ParentId
int ChildName
with the following values...
Parent
ID ParentName
^^^^ ^^^^^^^^
1 John
2 Jane
Child
ParentId ChildName
^^^^^^ ^^^^^^^
1 Jenny
1 Jake
1 Suzy
2 Nancy
2 Mick
And I want to get the report to look like this....
======== Page 1 ==========
Parent Name: John
Children: Jenny, Jake, Suzy
======== End of page 1======
======== Page 2 ==========
Parent Name: Jane
Children: Nancy, Mick
======== End of page 2======
This is easy enough to get working if the children are printed in a table but as I have to replace existing reports I cannot do this. I need to get the children to print as a comma separated list on one line.
Any help would be appreciated.
I was after some help getting something like this working....
If I have the following tables....
Parent
^^^^^
int Id
string ParentName
Child
^^^
int ParentId
int ChildName
with the following values...
Parent
ID ParentName
^^^^ ^^^^^^^^
1 John
2 Jane
Child
ParentId ChildName
^^^^^^ ^^^^^^^
1 Jenny
1 Jake
1 Suzy
2 Nancy
2 Mick
And I want to get the report to look like this....
======== Page 1 ==========
Parent Name: John
Children: Jenny, Jake, Suzy
======== End of page 1======
======== Page 2 ==========
Parent Name: Jane
Children: Nancy, Mick
======== End of page 2======
This is easy enough to get working if the children are printed in a table but as I have to replace existing reports I cannot do this. I need to get the children to print as a comma separated list on one line.
Any help would be appreciated.
how do i get multiple rows output as comma separated items on one line?
Hello,
As a way, you can use the Cross-Data component.
Thank you.
As a way, you can use the Cross-Data component.
Thank you.
- Attachments
-
- 1698.ReportSample.mrt
- (15.37 KiB) Downloaded 847 times
how do i get multiple rows output as comma separated items on one line?
Hi Aleksey,
This solves the issue but the solution causes another problem. The header band now no longer renders. Any suggestions?
Thanks
Martin
This solves the issue but the solution causes another problem. The header band now no longer renders. Any suggestions?
Thanks
Martin
how do i get multiple rows output as comma separated items on one line?
Hi Aleksey,
Noticed this solution only partially works. If there are too many items to fit into the container it does not wrap around to a new line. Do you have another suggestion?
Thanks
Martin
Noticed this solution only partially works. If there are too many items to fit into the container it does not wrap around to a new line. Do you have another suggestion?
Thanks
Martin
how do i get multiple rows output as comma separated items on one line?
Hello,
Another way, you can use addition code in events to prepare a string value in which all values will be contained.
Thank you.
Another way, you can use addition code in events to prepare a string value in which all values will be contained.
Thank you.
how do i get multiple rows output as comma separated items on one line?
We use Aleksey's suggestion for 3 years now and it always worked perfectly.
Create 1 string variable
Create 2 databands ( no relation )
In databand 1 loop though the data and in the beforeprint-event fill in the string+previous value of that string.
In databand 2 print the variable (and in the afterprint-event make it empty again).
We use this to create a full text out of separate sentences.
In your example you would have the "parents band"
underneat that you would have the "children band" with relation and master component set to the "parents band"
And underneat that "children band" you make a band to print the variable ( set the master component to the "parents band", no relation or datasource)
Create 1 string variable
Create 2 databands ( no relation )
In databand 1 loop though the data and in the beforeprint-event fill in the string+previous value of that string.
In databand 2 print the variable (and in the afterprint-event make it empty again).
We use this to create a full text out of separate sentences.
In your example you would have the "parents band"
underneat that you would have the "children band" with relation and master component set to the "parents band"
And underneat that "children band" you make a band to print the variable ( set the master component to the "parents band", no relation or datasource)
Using Stimulsoft since 2007
how do i get multiple rows output as comma separated items on one line?
Hi,
I now have this working on my report. One concern I have is that I do not feel that our support team will enjoy having to repeat these instructions to our customers when they want to create a report with a similar layout. Is there any chance of you adding a component that could surface this functionality without the extra complexity. We are obviously not the only user of your product who would appreciate it. Anyway my problem is now resolved.
Thanks to both of you for your help.
Martin
I now have this working on my report. One concern I have is that I do not feel that our support team will enjoy having to repeat these instructions to our customers when they want to create a report with a similar layout. Is there any chance of you adding a component that could surface this functionality without the extra complexity. We are obviously not the only user of your product who would appreciate it. Anyway my problem is now resolved.
Thanks to both of you for your help.
Martin
how do i get multiple rows output as comma separated items on one line?
Hello,
We have added your request to our to-do list. Try to add new function for this task in next release in March.
Thank you.
We have added your request to our to-do list. Try to add new function for this task in next release in March.
Thank you.
how do i get multiple rows output as comma separated items on one line?
Hello,
We made some improvements in that direction. Solution will be available in release in March.
You can use the following expression:
example:
{Func.EngineHelper.JoinColumnContent(Categories, "CategoryName", ", ")}
Thank you.
We made some improvements in that direction. Solution will be available in release in March.
You can use the following expression:
Code: Select all
{Func.EngineHelper.JoinColumnContent(DataSourceName, "ColumnName", delimiter)}
{Func.EngineHelper.JoinColumnContent(Categories, "CategoryName", ", ")}
Thank you.
how do i get multiple rows output as comma separated items on one line?
Hi Aleksey
That's great news.
Additionally, I'd like to add something.
We concatinate sentences using the method I described above.
BUT... Based on a certain value in a certain column we use different separators.
Sometimes we use a dot, sometimes we use a comma and sometimes we use ";"
Are there any plans on including conditions in this functionality?
That's great news.
Additionally, I'd like to add something.
We concatinate sentences using the method I described above.
BUT... Based on a certain value in a certain column we use different separators.
Sometimes we use a dot, sometimes we use a comma and sometimes we use ";"
Are there any plans on including conditions in this functionality?
Using Stimulsoft since 2007