We've bought Report.JS package and we've encountered an issue with creating relations between data sources.
In our code we are specifying relation's name and alias in the StiDataRelation constructor, but it's not reflected in the dictionary after execution of the regRelation function.
Here is a sample code:
Code: Select all
const designer = new Stimulsoft.Designer.StiDesigner(options, 'StiDesigner', false);
// Load report
const report = new Stimulsoft.Report.StiReport();
report.load(input.reportBody);
designer.report = report;
// Load data as dictionary
const dataSet = new Stimulsoft.System.Data.DataSet("SimpleDataSet");
const relations = input.data.relations;
delete input.data.relations;
dataSet.readJson(input.data);
// Handle relations
report.regData(dataSet.dataSetName, "", dataSet);
report.dictionary.synchronize();
const newRelation = new Stimulsoft.Report.Dictionary.StiDataRelation(
"GroupToProduct[products]",
"products", // desired name
"products", // desired alias
report.dictionary.getDataSourceByName("Group"),
report.dictionary.getDataSourceByName("Product"),
["productGroup"],
["id"]
);
report.dictionary.regRelation(newRelation, false);
report.dictionary.synchronize();
And here is an example of created relation:
The name and alias are set to the name of a parent source name, no matter what is putted in the StiDataRelation constructor.
How can we set the name and alias correctly?
Thank you,
Rafał