Page 1 of 1

Not able to register parent and child datasources

Posted: Wed Aug 08, 2018 5:38 am
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

Re: Not able to register parent and child datasources

Posted: Thu Aug 09, 2018 8:21 pm
by Lech Kulikowski
Hello,

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

Thank you.

Re: Not able to register parent and child datasources

Posted: Fri Aug 10, 2018 7:21 am
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

Re: Not able to register parent and child datasources

Posted: Mon Aug 13, 2018 11:14 am
by Lech Kulikowski
Hello,

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

Thank you.

Re: Not able to register parent and child datasources

Posted: Mon Aug 13, 2018 11:21 am
by mrapi
hi.I've wrote above how I fixed

Re: Not able to register parent and child datasources

Posted: Tue Aug 14, 2018 9:43 am
by Lech Kulikowski
Hello

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

Thank you.