Porting from Stimulsoft Reports PHP to Web

Stimulsoft Reports.JS discussion
xiaochris
Posts: 26
Joined: Wed Feb 03, 2016 1:27 am

Porting from Stimulsoft Reports PHP to Web

Post by xiaochris »

Hi,

I am trying to convert my designer / viewer from PHP to designer / viewer HTML5/JS

would like to know how do I / Where do i add codes to programmatically add data source?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Porting from Stimulsoft Reports PHP to Web

Post by HighAley »

Hello.

Unfortunately, there is no manual about changing components from Flash to JS.
You could look at the Sample sites that you can find in our distributive.

Data Sources should be added in JavaScript code. You could find this code on our Knowledge Base.

We will be glad to answer any your questions.

Thank you.
xiaochris
Posts: 26
Joined: Wed Feb 03, 2016 1:27 am

Re: Porting from Stimulsoft Reports PHP to Web

Post by xiaochris »

Hi ,

I would just want to force the data source to appear from designer / viewer from code. How do i do it?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Porting from Stimulsoft Reports PHP to Web

Post by HighAley »

Hello.

You could find it in the article on the link above. Here is this code:

Code: Select all

    var report = new Stimulsoft.Report.StiReport();
 
    //Add data to datastore
    report.regData("data", "data", dataSet);
 
    //Fill dictionary
    var dataSource = new Stimulsoft.Report.Dictionary.StiDataTableSource(data.tableName, data.tableName, data.tableName);
    dataSource.columns.add(new Stimulsoft.Report.Dictionary.StiDataColumn("Column1", "Column1", "Column1"));
    dataSource.columns.add(new Stimulsoft.Report.Dictionary.StiDataColumn("Column2", "Column2", "Column2"));
    report.dictionary.dataSources.add(dataSource);
Thank you.
xiaochris
Posts: 26
Joined: Wed Feb 03, 2016 1:27 am

Re: Porting from Stimulsoft Reports PHP to Web

Post by xiaochris »

Hi HighAley,

Do you have a sample project which hardcode mysql connection string into the reports
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: Porting from Stimulsoft Reports PHP to Web

Post by Jan »

Hello,

You can use following code to replace connection string in the report by new connection string:

Code: Select all

report.Databases.Clear(); 
report.Databases.Add(new Stimulsoft.Report.Dictionary.StiMySqlDatabase("NameInReport", ConnectionString
);

Also please check following url: http://support.stimulsoft.com/index.php ... at-runtime

Let me know if you need any additional help!

Thank you.
xiaochris
Posts: 26
Joined: Wed Feb 03, 2016 1:27 am

Re: Porting from Stimulsoft Reports PHP to Web

Post by xiaochris »

Hi Jan ,

So is the code like so ?

Code: Select all

report.Databases.Clear(); 
report.Databases.Add(new Stimulsoft.Report.Dictionary.StiMySqlDatabase("ConnectionNameInReport", "server=localhost;uid=root;pwd='pwd';db='testdb'");
where do i place this code?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Porting from Stimulsoft Reports PHP to Web

Post by HighAley »

Hello.

You should put this code after loading of the report and before showing it.

Thank you.
xiaochris
Posts: 26
Joined: Wed Feb 03, 2016 1:27 am

Re: Porting from Stimulsoft Reports PHP to Web

Post by xiaochris »

Hi HighAley,

realized that the code didn't work.

Only this works. We had to put a extra .dictionary
this code is then placed at designer.php

Code: Select all

report.dictionary.databases.clear();
var database = new Stimulsoft.Report.Dictionary.StiMySqlDatabase("Demo","MySQL", "server=serveraddress;db=dbname;uid=userid;pwd=pass;");
report.dictionary.databases.add(database);
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Porting from Stimulsoft Reports PHP to Web

Post by HighAley »

Hello.

Could you specify what product do you use?
We answered you how to do this in Reports.Web product.
You can't use this code in Reports.PHP.

Thank you.
Post Reply