Binding Data to a Report With Json Object

Stimulsoft Reports.JS discussion
Post Reply
felipemoreira
Posts: 38
Joined: Wed Mar 30, 2016 1:52 pm
Location: Brazil

Binding Data to a Report With Json Object

Post by felipemoreira »

Hi.

I have following code:

Code: Select all

    //my js object
    var object = {
        test: "yay"
    }
   
    //my json object
    var test = JSON.stringify(object);
   
    //Dataset created
    var dataSet = new Stimulsoft.System.Data.DataSet("teste");
    dataSet.readJson(test)

    var report = new Stimulsoft.Report.StiReport();
    report.loadFile("js/report_teste.mrt");
    report.regData(dataSet.dataSetName, "", dataSet);

    report.dictionary.connect(false);
    report.dictionary.synchronize();

    var viewer = new Stimulsoft.Viewer.StiViewer();
    viewer.report = report;
The code works, show my report file correctly, however without any data. Was to show my json object in report, was not it?
My report file has only one Report Title Band and a text component, with a fixed label.

What i need to do to show my json object(or json array whatever) on my report ? What i´m doing wrong ?

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Binding Data to a Report With Json Object

Post by HighAley »

Hello.

Please, check the name of data source.
You could try to open the report in designer. You could see there what is wrong.
If you still need our help, please, send us your report template with data.

Thank you.
felipemoreira
Posts: 38
Joined: Wed Mar 30, 2016 1:52 pm
Location: Brazil

Re: Binding Data to a Report With Json Object

Post by felipemoreira »

Thanks HighAley. Your answer helped me to think more about of structure of report and the data.
I made some adjustments and it´s work now.

You can close this tread.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Binding Data to a Report With Json Object

Post by HighAley »

Hello.

We are always glad to help you.
Please, let us know if you need our help.

Thank you.
Post Reply