Datasource type

Stimulsoft Reports.JS discussion
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

Datasource type

Post 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.
Attachments
piece.json
(15.12 KiB) Downloaded 114 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Datasource type

Post 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.
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

Re: Datasource type

Post 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.
Attachments
piece.mrt
(61.67 KiB) Downloaded 115 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Datasource type

Post by Lech Kulikowski »

Hello,

Please clarify how do you add sources in that report and save that .mrt file?

Thank you.
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

Re: Datasource type

Post 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.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Datasource type

Post 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.
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

Re: Datasource type

Post by fabien »

Hi,

datasource.zip attachment show the issue.
Save the template and edit it.

Data sources is "StiBusinessObjectSource" types.

Thanks,

Fabien.
Attachments
datasource.zip
(3.87 KiB) Downloaded 128 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Datasource type

Post 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.
Attachments
Screenshot 2021-07-23 160050.png
Screenshot 2021-07-23 160050.png (340.44 KiB) Viewed 1482 times
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

Re: Datasource type

Post by fabien »

Hi,

the issue is still present.
I've attached a sample project for analysis.
pieces.zip
(18.18 KiB) Downloaded 106 times
I use 2021.3.4 version : file : version.png.
Attachments
version.png
version.png (55.41 KiB) Viewed 1325 times
pieces.png
pieces.png (55.49 KiB) Viewed 1325 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Datasource type

Post by Lech Kulikowski »

Hello,

Please check the last build 2021.3.7

Thank you.
Attachments
Screenshot 2021-08-24 231818.png
Screenshot 2021-08-24 231818.png (320.56 KiB) Viewed 1301 times
Post Reply