Concatenate data

Stimulsoft Reports.NET discussion
StixStax
Posts: 46
Joined: Wed Aug 12, 2015 9:41 am

Concatenate data

Post by StixStax »

Hi,

i have data on a databand which comes out this way:

Text1: Person A
Text2: Person B
Text3: Person C
...

I would like to concatenate this data and have the output in one text:
Text1: Person A, Person B, Person C

Do you have an idea how I could accomplish this?
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: Concatenate data

Post by Jan »

Hello,

You can use following expression in text component if PersonA, PersonB and PersonC is a fields of the one data row:

Code: Select all

{Person A} {Person B} {Person C}
Please contact us if you need any additional help.

Thank you.
StixStax
Posts: 46
Joined: Wed Aug 12, 2015 9:41 am

Re: Concatenate data

Post by StixStax »

Hey Jan,

Its the same field in the data structure, where Person comes from.

I added sample data to show what my desired output should look like. I need to concatenate the strings from the same data field as shown in the last cell at the bottom of the page (all countries). Do you have an idea how to get rid of the rest of the cells?
Attachments
Concat.png
Concat.png (37.21 KiB) Viewed 6756 times
Demo.xml
(1.79 MiB) Downloaded 330 times
Demo.xsd
(12.72 KiB) Downloaded 238 times
ConcatData.mrt
(14.26 KiB) Downloaded 349 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Concatenate data

Post by HighAley »

Hello.

If you need to join values from the same column and different records, then you could use next expression:

Code: Select all

{Func.EngineHelper.JoinColumnContent(Countries, "CountryName", ",")}
Thank you.
StixStax
Posts: 46
Joined: Wed Aug 12, 2015 9:41 am

Re: Concatenate data

Post by StixStax »

Exactly what I needed. Thank you so much. Thank you for your fast reply
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Concatenate data

Post by HighAley »

Hello.

We are always glad to help you.

Thank you.
StixStax
Posts: 46
Joined: Wed Aug 12, 2015 9:41 am

Re: Concatenate data

Post by StixStax »

Hi,

do you have an idea how to exclude same strings? I do not have the textfield on a databand.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Concatenate data

Post by HighAley »

Hello.

Please, describe your scenario more detailed.
What do you need to exclude and by what condition.
Could you send us a sample report template with data?

Thank you.
StixStax
Posts: 46
Joined: Wed Aug 12, 2015 9:41 am

Re: Concatenate data

Post by StixStax »

In the following example "Andorra" is listed multiple times. How can I change the report, so I can only see it once?
Attachments
multipleCountries.png
multipleCountries.png (25.16 KiB) Viewed 6708 times
Demo.xsd
(12.72 KiB) Downloaded 231 times
Demo.xml
(1.79 MiB) Downloaded 199 times
Removeduplicates.mrt
(14.14 KiB) Downloaded 295 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Concatenate data

Post by HighAley »

Hello.

You should create a Data Source from other data source with grouping on duplicating column. And then use it in the JoinColumnContent function.

Please, look at the attached report template.

Thank you.
Post Reply