DataSet With Two Tables

Stimulsoft Reports.JS discussion
Post Reply
el7lme
Posts: 2
Joined: Mon Jul 09, 2018 9:18 am

DataSet With Two Tables

Post by el7lme »

I have a problem when creating a report which has two separate tables as i defined a custom data source then added two tables "salesInvoice" & "SysCompany"
st.png
st.png (59.57 KiB) Viewed 2522 times

In JS i did the following code
this.report.loadFile(this._getSubFolder()+'/'+file.FileName);

// Set Company Dataset
var dataSetCompany = new Stimulsoft.System.Data.DataSet("SysCompany");
dataSetCompany.readJson(JSON.stringify(this.SelectedCompany))
this.report.regData("SysCompany", "", dataSetCompany);

// Set Sales Invoice Dataset
var dataSet = new Stimulsoft.System.Data.DataSet("salesInvoice");
dataSet.readJson(JSON.stringify(this.Data))
this.report.regData(dataSet.dataSetName, "", dataSet);

I tried many many scenario like attached two tables as one json and send but no way
All result give me NAN

I am using Stimulsoft 17_2_3 JS
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: DataSet With Two Tables

Post by Lech Kulikowski »

Hello,

Please try to use the synchronize() method. If the issue still present, please send us your JSON data for analysis.

Thank you.
el7lme
Posts: 2
Joined: Mon Jul 09, 2018 9:18 am

Re: DataSet With Two Tables

Post by el7lme »

Now its working
I have combined the two dataset on one Json variable ans register the dataset.

// Coabmbine Two Table Into One Json Object
reportData={details:this.Data,SysCompany:this.SelectedCompany}
// Define DataSet For Report
var dataSet = new Stimulsoft.System.Data.DataSet("root");
//Read Data Into Defined Dataset
dataSet.readJson(JSON.stringify(reportData))

// Register Defined Data Set
this.report.dictionary.databases.clear();
this.report.regData("root", "root", dataSet);
this.report.dictionary.synchronize();

Many Thanks to Lech Kulikowski
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: DataSet With Two Tables

Post by Lech Kulikowski »

Hello,

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.
Post Reply