How to pass json data to report

2 Answers 16 Views
.NET Core DataSource JSON Report Designer (standalone) Report Parameters Report Viewer - HTML5
Siva
Top achievements
Rank 1
Iron
Siva asked on 27 Mar 2024, 11:02 AM
currently we are using webservice datasource to generate a report but i want to change this datasource from webservicedatasource to jsondatasource, when i manually put the json in inline, its working perfectly but how to pass the data from programatically , as of now we are using telerik.reportserver.httpclient dll and createdocumentdata model to send an data to report but i could not see any fields available in the model to accept json data. Anyone help on this and its a large report it has lot of tables , list ,fields etc

2 Answers, 1 is accepted

Sort by
0
Momchil
Telerik team
answered on 01 Apr 2024, 07:03 AM

Hi Siva,

One way to pass the JSON data to the report is to add a report parameter of type string and bind its value to the DataSource.Source property of each data item that uses your JSON data source.

The following Knowledge Base article provides additional information about this approach.

How to set the content of JsonDataSource through report parameter

I hope this option works for you.

Best Regards,
Momchil
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
0
Siva
Top achievements
Rank 1
Iron
answered on 01 Apr 2024, 10:12 AM

Hi Momchil 

I have already tried this , while configuring the jsondatasource i cant select the parameter value to it, and it only accepts inline json data or external json file.

 

And also i tried to map the json in to parameter, but i cant use the value in my textbox fields, because in textbox does nt have datasource property, in that document its not clear.

 

Can anyone let me know if any option is there.

Momchil
Telerik team
commented on 03 Apr 2024, 11:21 AM

Hi Siva,

You are correct, the source of the JSON data source accepts only inline JSON data and external JSON files.

The workaround binds the source of the JSON data source on the data item level at runtime. For example, if we have a table that uses a JSON data source and we want to change the data of the table based on a parameter value, we need to add a binding in the table's Bindings property.

To illustrate this, I am attaching a demo solution that passes JSON data to a report from a controller. Please, examine the attached solution as well as the report inside it and let me know if any questions arise.

Tags
.NET Core DataSource JSON Report Designer (standalone) Report Parameters Report Viewer - HTML5
Asked by
Siva
Top achievements
Rank 1
Iron
Answers by
Momchil
Telerik team
Siva
Top achievements
Rank 1
Iron
Share this question
or