This is a migrated thread and some comments may be shown as answers.

Create Pivot table from Comma Seperated List

6 Answers 34 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Donald McLean
Top achievements
Rank 2
Donald McLean asked on 01 Feb 2021, 08:06 PM

I have a comma separated field of payment options in a database and for each option I want to generate a checkbox and label see attached picture

6 Answers, 1 is accepted

Sort by
0
Donald McLean
Top achievements
Rank 2
answered on 02 Feb 2021, 02:18 PM
here is the image
0
Dimitar
Telerik team
answered on 04 Feb 2021, 01:29 PM

Hi Donald,

Such a result can be achieved with the use of a List that will serve as a container for the checkbox items.

If I understand correctly, the data field looks something like this:

 "data":"Credit,Cash,Debit,Cheque"

If that's so, please follow the steps below:

1. Add a List and set its DataSource property.

2. Create a Checkbox for each item, in our case that would mean that we need to create 4 checkboxes.

3. To have each textbox display the correct text, set its Text property to the following expression:

= Item(0, Split(",", Fields.data))

There are a couple of things happening here. The Item function accepts two arguments - index and a collection(array). it then returns the element of the collection with the given index(zero-based). We use the Split function, which returns a string array that contains the substrings in this instance that are delimited by the specified separator, to split the Fields.data string into a string array that we provide to the Item function. We use that function for each checkbox with the corresponding index to get the Cash, Debit, Credit, Cheque values.

By default, the checkboxes will be displayed with the image for the Indeterminate value, to display the checkboxes as unchecked set their Value field to False.

I have attached a sample report that you can use as a reference for completing this task.

Please let me know if you need further assistance.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Donald McLean
Top achievements
Rank 2
answered on 04 Feb 2021, 06:36 PM

I have it working sort of. I have created a table with a 2 textboxes and a check box, I have the first textbox as the text (ie Cash, Credit, etc) and the checkbox being checked based on whether or not there are fees with corresponding payment method. It also shows a checkbox for each item if I add or delete payment options. Only downside is it is going up and down instead side to side. You can see it in the picture attached the top part is all static text. Whereas the bottom table is generated. If I could do that it would be fantastic, however if not I can make it work.

0
Accepted
Dimitar
Telerik team
answered on 09 Feb 2021, 01:10 PM

Hello Donald,

It is possible to change the direction of the table by right-clicking on it and then selecting Rotate Layout.

Also, from what I understand you currently have a separate textbox for the text of the Checkbox. That however is not required, the Checkbox item has a Text property that you can use to set the text to be displayed next to the checkbox image. For more information, please have a look at the CheckBox Properties API.

I have attached a sample report with what I believe to be the desired result and a short video that you can use as a reference.

I hope that my reply is useful to you, don't hesitate to ask again if there is anything else that is unclear.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Donald McLean
Top achievements
Rank 2
answered on 18 Feb 2021, 02:08 PM
Thanks for your help Dimitar I managed to get it to work and it is populating. I had to anchor a bunch of the controls since the table forced them way to the right for some reason. I copied the table to another form where a client wanted the same information. However, the crazy issue is even though I had to do the anchoring left trick again, I am getting an extra blank page being generated when I export to pdf. I am looking through the knowledge base and forms trying to figure out why it is happening with little success.
0
Donald McLean
Top achievements
Rank 2
answered on 19 Feb 2021, 04:51 PM
Turns out I missed marking one element to be anchor left and it was causing the blank page
Tags
General Discussions
Asked by
Donald McLean
Top achievements
Rank 2
Answers by
Donald McLean
Top achievements
Rank 2
Dimitar
Telerik team
Share this question
or