Display custom data in table

1 Answer 22 Views
DataSources Report Parameters
Deepak
Top achievements
Rank 1
Deepak asked on 16 Aug 2021, 04:20 AM

Hello, 

I'm new to Telerik Reporting and I was trying to check if it was possible to show custom data in a table in Reporting.

Now I have seen posts where it was mentioned that this was possible...but unfortunately I was unable to make it work at my end.

In my sample....I have already designed a template which has a blank table. Now I was trying to populate the table with data dynamically, but it didn't seem to work.

I am able to view the data from a RDBMS server and  display it in “Preview” Mode in the reporting tool, but this is not what I want.

 

Here is my code.

int[,] arr = new int[2, 2];
arr[0, 0] = 0;     arr[0, 1] = 1;    arr[1, 0] = 2;      arr[1, 1] = 3;

var reportPackager = new Telerik.Reporting.ReportPackager();
using (var sourceStream = System.IO.File.OpenRead("SampleReport.trdp"))
{
    var report = (Report)reportPackager.UnpackageDocument(sourceStream);
    Telerik.Reporting.Table table = report.Items.Find("table1", true)[0] as Telerik.Reporting.Table;
     table.DataSource = arr;

}

Can someone point me to some sample code where something like this might be happening so that I can understand where I might be wrong?

Any help would be appreciated.

Thank you!

 

 

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 18 Aug 2021, 11:13 AM

Hi Deepak,

If I understood correctly, you would like to display data from an array in a table. Generally, this is possible.

Note that in the table details section you need to specify what should be displayed in each column. Usually, these would be fields from the data source. You may access the array items in the Expressions with '=Fields.Item'. The multi-dimensional array will be flattened.

If the table is initially blank, you need to add table columns, groups, etc. with code. You may find samples in the KBs referenced below.

If you would like to have a table, which columns change dynamically, I suggest the following KB articles that serve different scenarios:

Regards,
Todor
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
DataSources Report Parameters
Asked by
Deepak
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or