beginner

Stimulsoft Reports.JS discussion
leanribas
Posts: 8
Joined: Fri Feb 19, 2016 6:23 pm

beginner

Post by leanribas »

Hello , I do not know where to start to put together a report based mysql data through the manual I could not .

How should I start?

Thanks
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: beginner

Post by Jan »

Hello,

Please visit following url:

https://www.youtube.com/results?search_ ... soft+mysql

Thank you.
leanribas
Posts: 8
Joined: Fri Feb 19, 2016 6:23 pm

Re: beginner

Post by leanribas »

Thanks for your answer.
When I create a connection receive the following message.

Connection error: The database type is not supported by pure JavaScript.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: beginner

Post by HighAley »

Hello.

Please, read the Connect to MySQL and MS SQL Database section of the Stimulsoft Programming Manual.

Thank you.
leanribas
Posts: 8
Joined: Fri Feb 19, 2016 6:23 pm

Re: beginner

Post by leanribas »

Sorry, Anything work, There are a complete example?
leanribas
Posts: 8
Joined: Fri Feb 19, 2016 6:23 pm

Re: beginner

Post by leanribas »

I try this example

Code: Select all

<!DOCTYPE html>
<html>
<link href="css/stimulsoft.viewer.office2013.css" rel="stylesheet">
<script src="scripts/stimulsoft.reports.js"></script>
<script src="scripts/stimulsoft.viewer.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/jquery.min.js"></script>

<script type="text/javascript">
   
   //StiOptions.WebServer.url = "my1helper.php";
   var options = new Stimulsoft.Viewer.StiViewerOptions();
   options.toolbar.showAboutButton = false;
   options.appearance.showTooltips = false;

   var report = new Stimulsoft.Report.StiReport();
   
   //report.render();

   var viewer = new Stimulsoft.Viewer.StiViewer(options);

   $.ajax({
      type : 'POST',
      url  : 'myhelper.php',
      dataType: 'json',
      success: function(response)
      {         report.loadFile("Users.mrt");
         var dataSet = new Stimulsoft.System.Data.DataSet("Patient");
         dataSet.readJson(response);

         
         report.dictionary.dataSources.clear();
         report.regData("Patient", "Patient", dataSet);
         //report.regData(dataSet.datasetName, "", dataSet);
         report.dictionary.synchronize();         
         
         viewer.report = report;
         report.render();
      }
   });
   
   
   
</script>

<body>
</body>
</html>
Users.mrt

Code: Select all

{
    "ReportGuid":"03c6d42273a5-0942-262d-b7e2d99c5b9e",
    "ReportName":"Report",
    "ReportAlias":"Report",
    "ReportCreated":"/Date(1458689715000+0000)/",
    "ReportChanged":"/Date(1458689715000+0000)/",
    "CalculationMode":"Interpretation",
    "Dictionary": {
        "DataSources": {
            "0": {
                "Ident":"StiMySqlSource",
                "Name":"Patient",
                "Alias":"Patient",
                "Columns": {
                    "0": {
                        "Name": "Name", "Index": -1, "NameInSource": "Name", "Alias": "Name", "Type": "System.String"
                    }
                }
                ,
                "NameInSource":"Patient",
                "Type":0
            }
        }
    }
    ,
    "Pages": {
        "0": {
            "Ident":"StiPage",
            "Name":"Page1",
            "Guid":"d43d198c-7c8c-d32f-ba75-565f4a1e24a7",
            "Interaction": {
                "Ident": "StiInteraction"
            }
            ,
            "Border":";;2;;;;;solid:Black",
            "Brush":"solid:",
            "Components": {
                "0": {
                    "Ident":"StiDataBand",
                    "Name":"DataBand1",
                    "ClientRectangle":"0,0.4,19.01,1",
                    "Interaction": {
                        "Ident": "StiBandInteraction"
                    }
                    ,
                    "Border":";;;;;;;solid:Black",
                    "Brush":"solid:",
                    "Components": {
                        "0": {
                            "Ident":"StiText",
                            "Name":"Text1",
                            "MinSize":"0,0",
                            "MaxSize":"0,0",
                            "ClientRectangle":"2.8,0,3,0.6",
                            "Interaction": {
                                "Ident": "StiInteraction"
                            }
                            ,
                            "Text": {
                                "Value": "Name"
                            }
                            ,
                            "Border":";;;;;;;solid:Black",
                            "Brush":"solid:",
                            "TextBrush":"solid:Black"
                        }
                        ,
                        "1": {
                            "Ident":"StiText",
                            "Name":"Text2",
                            "MinSize":"0,0",
                            "MaxSize":"0,0",
                            "ClientRectangle":"5.8,0,8.2,0.6",
                            "Interaction": {
                                "Ident": "StiInteraction"
                            }
                            ,
                            "Text": {
                                "Value":"{Patient.Name}"
                            }
                            ,
                            "Border":";;;;;;;solid:Black",
                            "Brush":"solid:",
                            "TextBrush":"solid:Black"
                        }
                    }
                    ,
                    "DataSourceName":"Patient",
                    "DataRelationName":"[Not Assigned]"
                }
            }
            ,
            "PageWidth":21.01,
            "PageHeight":29.69,
            "Watermark": {
                "TextBrush": "solid:50,0,0,0"
            }
            ,
            "Margins": {
                "Left": 1, "Right": 1, "Top": 1, "Bottom": 1
            }
        }
    }
}
myhelper.php

Code: Select all

{
   "success": true,
   "notice": null,
   "object": null,
   "columns": ["Id", "Name"],
   "rows": [
      ["1", "hugo1"],
      ["2", "User2"],
      ["3", "User3"]
   ]
}
Only show one page empty, no data.

This example I got in this forum.

Whats wrong?

Thanks.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: beginner

Post by HighAley »

Hello.

It's not clear.
Could you specify do you want to use our MySQL adapter or create your own?
Please, look at Stimulsoft Samples 2016.1\Stimulsoft Reports.JS\Samples\PHP\02. Connect to databases\ sample.

Thank you.
leanribas
Posts: 8
Joined: Fri Feb 19, 2016 6:23 pm

Re: beginner

Post by leanribas »

Thanks for your answer.

I would make this example I showed work.

I'm actually very lost.

I work with Postgres database .

I'm trying to make something work . :(
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: beginner

Post by HighAley »

Hello.

Could you specify what database do you use? MySQL or PostgreSQL?
Maybe you need PostgreSQL adapter in Reports.JS?

Thank you.
leanribas
Posts: 8
Joined: Fri Feb 19, 2016 6:23 pm

Re: beginner

Post by leanribas »

Hello,

I use Postgresql.

Thanks.
Post Reply