Not able to register parent and child datasources

Stimulsoft Reports.JS discussion
Post Reply
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Not able to register parent and child datasources

Post by mrapi »

Hi
I'm trying to register parent and child datasources for a report.if I register one,I got NAN in data from second.this is the code used:

Code: Select all

 const report = new Stimulsoft.Report.StiReport();
    report.loadFile('reports/test.mrt');
      this.viewer.report = report;
      this.viewer.renderHtml('viewerContent');


       this.gService.get('/api/myapi').subscribe(r => {

        report.dictionary.databases.clear();

    const dataSet = new Stimulsoft.System.Data.DataSet('parent');
    dataSet.readJson(r.Parent);
     report.regData(dataSet.dataSetName, 'parent', dataSet);


    const dataSet2 = new Stimulsoft.System.Data.DataSet('child');
    dataSet2.readJson(r.Child);
         report.regData(dataSet2.dataSetName, 'child', dataSet2);

         report.dictionary.synchronize();
      });
report file is attached,json response:

Code: Select all

{"Parent":[{"ID":315,"wnrPozitii":5}],"Child":[{"ID_DOC":315,"DPRODUS":"ART 1"},{"ID_DOC":315,"DPRODUS":"ART2"},{"ID_DOC":315,"DPRODUS":"A3"},{"ID_DOC":315,"DPRODUS":"A4"},{"ID_DOC":315,"DPRODUS":"A90"}]}
need a help.thanks
Attachments
test.mrt
(6.67 KiB) Downloaded 151 times
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Not able to register parent and child datasources

Post by Lech Kulikowski »

Hello,

Please send us a sample project which reproduces the issue for analysis on support@stimulsoft.com

Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Not able to register parent and child datasources

Post by mrapi »

Hi.
With info form viewtopic.php?f=27&t=56611&p=150460&hil ... on#p150460 and viewtopic.php?f=27&t=55444&p=146096&hil ... on#p146096 I was able to register both datasources this way:

Code: Select all

 report.dictionary.databases.clear();
      const dataSet = new Stimulsoft.System.Data.DataSet('root');
       dataSet.readJson(JSON.stringify({ parent: r.Parent, child: r.Child }));
        report.regData(dataSet.dataSetName, '', dataSet );
but calling

Code: Select all

report.dictionary.synchronize() 
after code above produced a strange effect:in child table instead of real data, record 1 is repeated on every record.removing it fixed the problem
thanks
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Not able to register parent and child datasources

Post by Lech Kulikowski »

Hello,

Please send us a sample project which reproduces the issue for analysis on support@stimulsoft.com

Thank you.
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Not able to register parent and child datasources

Post by mrapi »

hi.I've wrote above how I fixed
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Not able to register parent and child datasources

Post by Lech Kulikowski »

Hello

Ok.
Please let us know if you need any additional help.

Thank you.
Post Reply