comma separated string in 3 columns

2 Answers 75 Views
General Discussions
Heiko
Top achievements
Rank 1
Veteran
Heiko asked on 31 May 2021, 07:02 PM

Hi!

My datasource includes one field which is a comma separated list of items. What I like to do is display these items in three columns inside my report.

Items: "item1, item2, item3, item4, item5, ... , itemX"
Displayed as

item1     item4    item7
item2    item5    item8
item3    item6    item9

How can I achieve this?

Regards
Heiko

2 Answers, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 03 Jun 2021, 01:10 PM

Hello Heiko,

Based on my understanding of your requirements, I will share details on how to achieve it and a sample report for you to analyze. Please find more details below.

The idea is to create a multi-column report down the page and then across it, similar to the scenario in the KB article. In order to do that, you need to configure the row and column groups in the Group Explorer to group the data by an index in the data source. My sample data has a column with the items and another column with indexes that will be used to define the columns (see dataSourceIndex.png). 

The difference between your scenario and the instructions in the KB article, is that you want the items to be listed down and then across the page. In this case, you need to swap the expressions for row group Grouping and column group Grouping from the fourth and fifth point.

I have attached a sample report demonstrating my approach, please check it out and let me know if you have any other questions or need further help. 

Regards,
Plamen Mitrev
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Heiko
Top achievements
Rank 1
Veteran
commented on 05 Jun 2021, 08:50 AM

Hello Plamen, and thank you for your help. This is a good example, but it does not solve my problem. The comma separated list of items is not a datasource itself, but a single FIELD inside my datasource, coming from a sql-query.
0
Plamen Mitrev
Telerik team
answered on 09 Jun 2021, 01:56 PM

Hello Heiko,

Thank you for your follow-up about the data you are using in the report.

From what I understand, all items listed in a single string and are separated by a comma ",". In this case, you need to create a User Function with custom logic that reads this data and splits it into different items in a List. I prepared a sample project with a User Function that takes the items as a string. You can find the sample project attached.

Explore the two Visual Studio projects and the linked Report and try to apply this on your end. The idea is to create a custom User Function and extend the Report Designer to be able to use it in the report. This gives you the opportunity to customize the data from the data source for your requirements. 

Let me know if you have any follow-up questions or need further guidance. Thank you for your cooperation in this discussion. 

Regards,
Plamen Mitrev
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Tags
General Discussions
Asked by
Heiko
Top achievements
Rank 1
Veteran
Answers by
Plamen Mitrev
Telerik team
Share this question
or