Set datasource to report using web api

Posted by: quanpv on 14 September 2017, 6:46 pm EST

    • Post Options:
    • Link

    Posted 14 September 2017, 6:46 pm EST

    [activereports_archive]Hi.

    I’m user activereport8 with html5 viewer by java scrip.

    My problems is how to set data source to report by web api service ( data type is json).

    Can you please help ?[/activereports_archive]

  • Posted 14 September 2017, 6:46 pm EST

    [activereports_archive]Hello,

    There isn’t any way to set the datasource of the report through javascript. So, to achieve your requirement we’ll have to use a workaround. The workaround is to convert the json data into a datatable. This isn’t the easiest of tasks but can be done with the help of the Json.Net framework. You can then set this datatable as the datasource of the Report being viewed in the HTML5Viewer. Kindly refer to the following forum links which will be helpful in implementing this :

    http://stackoverflow.com/questions/11981282/convert-json-to-datatable

    http://www.codeproject.com/Questions/590838/convertplusJSONplusstringplustoplusdatatable

    http://forums.asp.net/t/1964108.aspx?How+to+deserialized+JSON+data+into+Datatable

    Hope it helps

    Regards

    Abdias[/activereports_archive]

  • Posted 14 September 2017, 6:46 pm EST

    [activereports_archive]Thank you.

    I solved the problem by service api to save xml file and then set data source from file

    I think component one should method to create the data set to the report from json data in java scrip. it very good.

    Thank.[/activereports_archive]

  • Posted 14 September 2017, 6:46 pm EST

    [activereports_archive]You may suggest this as a feature by clicking on the ‘Suggest a Feature’ button on the home page of this forum.

    Thanks[/activereports_archive]

  • Posted 6 July 2019, 12:22 am EST

    Hi, i need to do the same, need to change the datasource server side because the datasource is dynamic. Do you have sample code of what you did to make it work?

    Appreciate it so much,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels