Page 1 of 2
Datasource type
Posted: Fri Jul 16, 2021 8:52 am
by fabien
Hi,
we use json data to allow to users to build report. Here source code :
Code: Select all
var report = new Stimulsoft.Report.StiReport();
report.loadDocument(<?php echo $json; ?>);
report.reportFile = "<?php echo $modele; ?>" + ".mrt";
var dataSet = new Stimulsoft.System.Data.DataSet("Data");
dataSet.readJson(<?php echo $json_donnees; ?>);
report.dictionary.databases.clear();
report.regData("Data", "Data", dataSet);
report.dictionary.synchronize();
designer.report = report;
View attached files :
- piece.mrt : template
- piece.json : data
If I edit piece.mrt, why datasources is StiBusinessObjectSource ?
When i add piece.json from designer, i've got a resource and datasources is StiDataTableSource.
The goal is to allow users to design report with example data ?
How i reproduce json data add as a resource and register it by code ?
Thanks,
Fabien.
Re: Datasource type
Posted: Fri Jul 16, 2021 12:54 pm
by Lech Kulikowski
Hello,
Business Objects are not supported in the JS version.
Please send your report template for analysis.
Also, the loadDocument() method is loaded already rendered reports and uses for showing reports, not for design. You should use load() methods:
https://www.stimulsoft.com/en/documenta ... report.htm
Thank you.
Re: Datasource type
Posted: Fri Jul 16, 2021 1:20 pm
by fabien
Thank you for the response.
ok for the load method instead of loadDocument, but datasource is again StiBusinessObjectSource.
I add the template : piece.mrt.
Thank you.
Fabien.
Re: Datasource type
Posted: Mon Jul 19, 2021 6:14 pm
by Lech Kulikowski
Hello,
Please clarify how do you add sources in that report and save that .mrt file?
Thank you.
Re: Datasource type
Posted: Tue Jul 20, 2021 10:03 am
by fabien
Hi,
I add sources by load piece.json file :
Code: Select all
dataSet.readJson(<?php echo $json_donnees; ?>);
report.regData("Data", "Data", dataSet);
$json_donnee is the content of piece.json attachment.
I thought that regData method alow to identify fields of datasources.
To save report, i click in "save" button in designer.
An handler is called to save report in php method.
Code: Select all
designer.onSaveReport = function (args, callback) {
Stimulsoft.Helper.process(args, callback);
}
Code: Select all
$handler->onSaveReport = function ($event) {
//HLog::ecrireDebug("OnSaveReport");
$report = $event->report; // Report object
$reportJson = $event->reportJson; // Report JSON
$fileName = $event->fileName; // Report file name
file_put_contents($fileName . ".mrt", $reportJson);
return StiResult::success("Save Report OK: " . $fileName);
};
Thanks,
Fabien.
Re: Datasource type
Posted: Tue Jul 20, 2021 1:40 pm
by Lech Kulikowski
Hello,
We couldn't reproduce the issue. Data sources should be "StiDataTableSource" types.
Please send us a sample project that reproduces the issue for analysis.
Thank you.
Re: Datasource type
Posted: Wed Jul 21, 2021 1:05 pm
by fabien
Hi,
datasource.zip attachment show the issue.
Save the template and edit it.
Data sources is "StiBusinessObjectSource" types.
Thanks,
Fabien.
Re: Datasource type
Posted: Fri Jul 23, 2021 2:02 pm
by Lech Kulikowski
Hello,
We couldn't reproduce the issue. Please try to check the last release build. If the issue is still present, please send us a full project for analysis.
Thank you.
Re: Datasource type
Posted: Mon Aug 23, 2021 3:23 pm
by fabien
Hi,
the issue is still present.
I've attached a sample project for analysis.
I use 2021.3.4 version : file : version.png.
Re: Datasource type
Posted: Tue Aug 24, 2021 9:18 pm
by Lech Kulikowski
Hello,
Please check the last build 2021.3.7
Thank you.