How to set Datasource in a crosstab ?

1 Answer 30 Views
CrossTab DataSource Object DataSources Table
Nicolas
Top achievements
Rank 1
Nicolas asked on 04 Mar 2025, 10:02 AM

Hi,

I want to generate a table with n columns and m rows, depending of the data source, I think using the crosstab is the best option, but I don't understand how to pass the datasource.

Data for columns are a list of StartProcess, and data for rows are a list of EndProcess

public class ProcessTreatment()
{
    public List<StartProcess> StartProcesses { get; set; } = [];
    public List<EndProcess> EndProcesses { get; set; } = [];
}

public class StartProcess()
{
    public int Id { get; set; }
    public string Code { get; set; }
}

public class EndProcess()
{
    public int Id { get; set; }
    public string Code { get; set; }
}

I would to show the code of the process for each one.

I tried to bind the datasource [=Fields.ProcessTreatment] at the tab, then put the value [=Fields.StartProcesses] at the column header, but only one column with this "System.Collections.Generic.List`1[OptaPlanning.Business.Reports.StartProcess]" is shown.

Can someone would help me how to insert properly the datasource please ?

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 06 Mar 2025, 04:11 PM

Hello Nicolas,

You need to flatten your DataSource to use it in a Crosstab. The reason is that each data item, like Crosstab, Table, etc., may have only a single DataSource. For example, you may create a single list with fields 'StartProcessId', 'StartProcessCode', 'EndProcessId', and 'EndProcessCode', and use the Start ones for row/column groups and End ones for column/row groups in the Crosstab. Note that when grouped, the Crosstab shows aggregated data in its detail cells. This may result in empty cells for group sections with no data.

Alternatively, you may nest two data items, i.e., Lists or Crosstabs. This will let you render the rows in the parent and the columns in the child data item or vice versa.

Regards,
Todor
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Tags
CrossTab DataSource Object DataSources Table
Asked by
Nicolas
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or