14 Answers, 1 is accepted
Setting the same datasource to a report and a table is usually not desired as this way, the same database rows would be repeated for the detail section in the report as well as in the table. Generally how you proceed is based on what you want to achieve. There are two options:
- Set the same datasource as in the report and apply a filter to the Table. You can filter the table datasource based on the main report's datasource by using =ReportItem.Parent.DataObject. From here on, you can be more concrete and define the exact field you would filter upon like so:
or based on your own conditions (e.g. report parameters).
- Use the Bindings property of the Table item to bind it to the same source as the report by using the following expression: =ReportItem.DataObject. You can see this in action in our ProductCatalog demo report.
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Generally a detail section is printed once for every data record. Thus if you want to have only one table instance our suggestion is to move the table item to a non repeater section such as an unbound group (group without grouping) footer/header section.Kind regards,
the Telerik team
Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.
I have one last problem in this kind of report
I have placed two table tools in the group header. One table shows all the rows which is correct it should as the values are different but in second table should only show one row as the values of all the fields are identical. How can I suppress the repeated values in the group header for the same Client id
Our suggestion is to set up a table/crosstab group to eliminate the duplicates. In order to set up a crosstab you can can use the crosstab wizard.
Additionally you may find useful the Grouping Data help articles.
Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.
I have a question: I have 3 tables used one DataSource.
If I create each table, adding same DataSource (as DataSource property) - do the DataSource is generates 3 times independently, as if there were 3 separate DataSource objects?
Is there an adventage, if I set this DataSource as report DataSource and then bind each table to it, with: ReportItem.DataObject?
(I have to do it not in detail section, but e.g. in header and it works ok) - is then this DataSource generated only once and the data are transported only once from server?
If a data item's DataSource is set directly, the item will request data each time it is rendered in the report (because the item can be placed in a repeating section).
If a data item's DataSource s set via binding to the container's data object, the data will be requested by the container' Datasource and then it will be reused by the nested data item (no second data-retrieving occurs). Details about this data-binding approach are available in How to use the ReportItem.DataObject property in expressions.
Thank you for the answer.
So - if I want to use a DataSource in multiple tables, it make sense to put this DataSource as report-object and refer to it via binding.
Yes, I can confirm that it is a suitable approach if you have many data items using the same data source.
Hi, thanks for answer, unfortunately I have found, that calculated fields are not recognized, via Fields.myField, if DataSource is set to report and used in table via binding:( (in simple usage table<->DataSource, calculated fields are recognized in same way as original fields).
Please check the attached demo report (TRDX file). It can be previewed with the Standalone Report Designer of Telerik Reporting Q1 2016 and requires a connection string to AdventureWorks database.
There is a SqlDataSource with two calculated fields.
The report's DataSource is set to the SqlDataSource component (sqlDataSource1). You can see the data in the Detail section. There is also a Table item in static group's header section - the Table.DataSource is set via binding to the report data object.
The Table item displays the calculated fields added to the SqlDataSource component that is used by the report.
Please elaborate on your settings and include details how to reproduce the problem.
When a Report is databound, it is intended that the detail section will be duplicated for each row returned by the dataset. A Table can also be databound, and the expected result is that the detail row of the table will be duplicated for each row in the dataset. When both are databound, and the table is inside the detail section - you will see multiple copies of the table (with the headers).
In order to get rid of the repeating Tables, there are two possible approaches:
- Leave the DataSource of the report to None and set only the DataSource of the Table item.
- Move the Table to a report section that doesn't duplicate - such as group headers or footers of a static group.