Completed
Last Updated: 06 May 2022 17:21 by ADMIN
Release R3 2021 SP1
Rick Kauwen
Created on: 05 Dec 2014 16:20
Type: Feature Request
15
Make Report.DataSources property public
The property DataSources is internal in the Report class. When manipulating the datasources of a report it's easier to have access to this collection than to go through all the elements en report parameters to check for datasources
11 comments
ADMIN
Neli
Posted on: 06 May 2022 17:21

Hello Greg,

Setting the JSON data dynamically of a JsonDataSource is indeed possible. The JSON data can be passed by using a report parameter. You need to set the binding property of the data item that uses the JSON DataSource. For example, if you have set the JSON DataSource to the report, then you have to set the Binding property of the report. Please see the How to set the content of JsonDataSource through report parameter KB article for further information. At the end of the article, there is also a sample report implementing this approach that you may download.

I hope this fits your needs, please do not hesitate to let us know if you need additional information.

Thank you for using Telerik Reporting!

Regards,
Neli
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/.
Greg
Posted on: 01 May 2022 23:43

The JsonDataSource is pretty much unusable. Without the ability to set the JSON via a property and/or code it's unusable. NO ONE uses file data in a web or blazor app!!!!! NO ONE hardcodes JSON data!!!!!

We want to get our own JSON object and SIMPLY assign it to a report. This is impossible currently. Terrible.

ADMIN
Ivan Hristov
Posted on: 12 Oct 2021 17:36

Hi Mirzodaler,

Thank you for sharing the scenario in question.

Given the provided description, it seems that you're using the JSON data source to store some metadata within the report definition. Such feature is not yet available but I noticed you've logged a request for it here. At this point it is not in our immediate implementation plans, but I confirm the data sources collection we return from the newly introduced method will also include the "detached" data sources in case you're deserializing .trdx or .trdp report. You mentioned you're reading raw XML, so you'll be able to use the new feature and obtain references to all the data sources in the report definition.

To illustrate it with code, if you have the following TRDX report definition:

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.telerik.com/reporting/2021/2.0">
  <DataSources>
    <JsonDataSource Name="jsonDataSource1">
      <Source>
        <String>e25hbWU6IkpTT04ifQ==</String>
      </Source>
    </JsonDataSource>
  </DataSources>
</Report>

you'll be able to get the JSONDataSource's data like this:

            var jsonDs = ((Telerik.Reporting.Report)new ReportXmlSerializer()
                .Deserialize("report.trdx"))
                .GetDataSources().OfType<JsonDataSource>().First();
            System.Diagnostics.Debug.Assert(string.Equals(jsonDs.Source,"{name:\"JSON\"}"));

I hope this answers your question, but if you need more information, let us know.

All best,

Ivan Hristov

Reporting Team

Mirzodaler
Posted on: 07 Oct 2021 12:26

Hello Ivan,

Thank you for letting us know. Our scenario is custom so it will be nice to have a feature, although we have a workaround for it.

We have a JSON data source for each report file which isn't attached to any report items. The JSON data source provides additional information about the report. When the file is uploaded to the system, we read from that data source to understand more about the report. When trying to read the data source, there is no way to read it. The workaround we are using is to read from the RAW XML.

So if there is a way to include that in the collection, it will be great!

 

Thanks,

ADMIN
Ivan Hristov
Posted on: 07 Oct 2021 11:33

Hello Mirzodaler,

Thank you for your questions. Yes, indeed the Report Designers allow to create data sources without assigning them to a data item. Such data sources  do not make much sense in the report model, so they cannot be created programmatically. In reports, created using Visual Studio, these data sources will not be included in the collection, returned by the GetDataSources() method, because they're just fields in the Report class. In reports, created with Standalone  Report Designer and Web Report Designer, the data sources are instantiated at the beginning of the deserialization process and later they are not removed from that collection regardless if they are attached to data items or not. Again, having such data sources should not be regarded as a normal state of the report, but more as a intermediate stage of report designing process. It is absolutely possible that we overlook some specific scenario where such non-assigned data sources are useful, so please share more about your case so we consider it on our end.

All best,

Ivan Hristov

Reporting Team

Mirzodaler
Posted on: 06 Oct 2021 11:50

Hi Ivan,

Thank you for the update. The Report Designer allows creating data sources and doesn't attach them to report items.  So it can be data sources that are not attached.

  1. Can we access those data sources with that read-only collection?
  2. Can we create data sources and do not attach them to report items programmatically? Currently, it is not possible but with the designer it is possible.

Thanks,

ADMIN
Ivan Hristov
Posted on: 17 Sep 2021 11:57

Hi Tursunkhuja,

We did not manage to implement the feature for the R3 2021 release, but it is scheduled for implementation for our R3 2021 SP1 release, which is due in a month. Here is a brief description how we plan to approach the problem:
We'll expose a public method that returns an IEnumerable<IDataSource>. All the public data source classes like SqlDataSource, ObjectDataSource, JsonDataSource, etc. implement this interface, which will be made public. The collection will return the references to the actual IDataSource instances contained in the report and its data items, including the report parameters. The collection will be read-only, i.e. the users will not be able to remove or add items from/in it, but when iterating through the collection, it will be possible to change the properties of the data source instances, effectively modifying the report definition.

We believe this implementation will cover the most popular scenarios - for example, where all the SQL data sources in a report might need to have their connection string modified. Still, if your scenarios differ and the proposed approach won't help, please let us know.

All best,

Ivan Hristov

Reporting Team

Tursunkhuja
Posted on: 17 Sep 2021 03:56

Hello,

This feature request is not listed in the release history of R3.2021 Telerik Reporting - ProgressĀ® TelerikĀ® Reporting R3 2021 (15.2.21.915)

When do you plan to implement this feature?

 

Thank you,

ADMIN
Milen | Product Manager @DX
Posted on: 02 Apr 2021 05:56

Hello,

This feature would make dynamic data sources manipulation much easier and we are considering it for the R3 2021 release, scheduled for mid-September.

Thank you for your input.

Regards,
Milen
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/.

Tursunkhuja
Posted on: 26 Mar 2021 08:59

We also need this feature and it will make our work easier.

When do you plan to realize this feature?

 

Thanks,

 

Mirzodaler
Posted on: 08 Oct 2020 12:33
We need this feature as well. Also, if the collection is public, we assume that it will be editable.