Datasource type

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

Datasource type

Post by fabien » Fri Jul 16, 2021 8:52 am

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 23 times
Lech Kulikowski
Posts: 3937
Joined: Tue Mar 20, 2018 5:34 am

Re: Datasource type

Post by Lech Kulikowski » Fri Jul 16, 2021 12:54 pm

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: 16
Joined: Thu Jul 15, 2021 9:07 am

Re: Datasource type

Post by fabien » Fri Jul 16, 2021 1:20 pm

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 25 times
Lech Kulikowski
Posts: 3937
Joined: Tue Mar 20, 2018 5:34 am

Re: Datasource type

Post by Lech Kulikowski » Mon Jul 19, 2021 6:14 pm

Hello,

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

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

Re: Datasource type

Post by fabien » Tue Jul 20, 2021 10:03 am

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: 3937
Joined: Tue Mar 20, 2018 5:34 am

Re: Datasource type

Post by Lech Kulikowski » Tue Jul 20, 2021 1:40 pm

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: 16
Joined: Thu Jul 15, 2021 9:07 am

Re: Datasource type

Post by fabien » Wed Jul 21, 2021 1:05 pm

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

Re: Datasource type

Post by Lech Kulikowski » Fri Jul 23, 2021 2:02 pm

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 287 times
fabien
Posts: 16
Joined: Thu Jul 15, 2021 9:07 am

Re: Datasource type

Post by fabien » Mon Aug 23, 2021 3:23 pm

Hi,

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

Re: Datasource type

Post by Lech Kulikowski » Tue Aug 24, 2021 9:18 pm

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 106 times
Post Reply