Report not dispalying data

Stimulsoft Reports.JS discussion
Post Reply
mister_rom
Posts: 4
Joined: Mon Feb 04, 2019 6:16 am

Report not dispalying data

Post by mister_rom »

Hi,

I'm new in Stimulsoft Reports, and I'm blocked in my first report using javascript + ASP (classic ASP), which don't display data. Only the title is displayed.
I tested and tryed to debug, the problem seems about data sent to the report. I tried during 2 days, and could not find the problem.

This is a sample of my code, with 2 lines of data included :

Code: Select all

<head>

    <meta charset="utf-8">

    <link href="css/stimulsoft.viewer.office2013.lightgrayblue.css" rel="stylesheet">

    <script src="js/licence_reporting.js"></script>

    <script src="js/stimulsoft.reports.js" type="text/javascript"></script>
    <script src="js/stimulsoft.viewer.js" type="text/javascript"></script>

    <script src="reports/report_types_ponts.js"></script>

    <script type="text/javascript">
        // Zone de visualisation de l'état
        let viewer = null;

        function Start()
        {
            // données à imprimer
            let donneesEtat = { "types_ponts" : [{ "code" : "BUSE", "libelle" : "Buse" }, { "code" : "BWSTRING", "libelle" : "Bow String" }] } ;

            // appel pour initialisation licence
            Stimulsoft.Base.StiLicense.key = licenceReporting();

            let report = new Stimulsoft.Report.StiReport();

            viewer = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
            viewer.renderHtml("report");

            report.load(reportTypesPonts);
            report.dictionary.databases.clear();

            report.regData("", "", donneesEtat);

            viewer.report = report;
        }
    </script>

</head>

<body onload="Start()">

    <div id="report"></div>

</body>

</html>

This is some explanations to understand the code :
- donneesEtat containts the data
- reportTypesPonts is coming from one incldue file ("report_types_ponts.js") and containt the JSON content of the MRT report
- licenceReporting() is a function which returns the licence key
I know that the report is well loaded because the title is displayed correclty, even when I change it. I attach the report file and screenshots of the displayed report

I really need someone to help me please ...
Have a good day.

B.R
Attachments
report_types_ponts.js
(15.29 KiB) Downloaded 109 times
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Report not dispalying data

Post by Lech Kulikowski »

Hello,

In your report is used MS SQL data source but in your code databases is cleared and add data as DataSet. Please check that tables and columns have the same names.
Also, try to clear data sources also:
report.dictionary.datasources.clear();

and add synchronize() method after regData().

Thank you.
mister_rom
Posts: 4
Joined: Mon Feb 04, 2019 6:16 am

Re: Report not dispalying data

Post by mister_rom »

Hi,

Thanks for your help, but i still have the same problem.
I did what you told me :
- adding dataSet
- check names of table and columns
- synchronise

I could not apply : report.dictionary.datasources.clear();
It seems that .datasources does not exist. When I put it, the code is no more executed after this line, causing nothing at all is displayed. If I remove the line, the toolbar and the title of the report are displayed. What is the good command ?

This is my current code and attached the report and a sample of full page (to be rename test.html) with data inside :

Code: Select all

function Start()
        {
            // données à imprimer
            let donneesEtat = <%=donneesEtat%>;

            // appel pour initialisation licence
            Stimulsoft.Base.StiLicense.key = licenceReporting();

            // sélection de la langue francaise
            Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("xml/reports_fr.xml", true);

            let dataSet = new Stimulsoft.System.Data.DataSet("data");
            let report = new Stimulsoft.Report.StiReport();

            viewer = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
            viewer.renderHtml("report");

            dataSet.readJson(donneesEtat);

            report.load(reportTypesPonts);
            report.dictionary.databases.clear();
            //report.dictionary.DataSources.clear();

            report.regData(dataSet.dataSetName, dataSet.dataSetName, dataSet);
            report.dictionary.synchronize();

            viewer.report = report;

        }
Thanks to help again.
Attachments
test.txt
(3.12 KiB) Downloaded 132 times
report_types_ponts.js
(11.48 KiB) Downloaded 106 times
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Report not dispalying data

Post by Lech Kulikowski »

Hello,

You should add:
report.dictionary.dataSources.clear();

Thank you.
mister_rom
Posts: 4
Joined: Mon Feb 04, 2019 6:16 am

Re: Report not dispalying data

Post by mister_rom »

Hi,

Thanks a lot, it's working fine now ...
I just added the line you provided to me : report.dictionary.dataSources.clear();

Just a quick one : Stimulsoft Reports is a very good and useful tool, but your documentation is really poor. You should really improve it, as your tool is fine.

Have a good day.
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Re: Report not dispalying data

Post by Andrew »

Hello,

Thank you for the reply. I am happy that you solved the issue.

Regarding the documentation, we are constantly updating it. In a couple of the days the next update will be live.

Thank you.
Post Reply