Page 1 of 2
Porting from Stimulsoft Reports PHP to Web
Posted: Wed Feb 10, 2016 8:14 am
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?
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Wed Feb 10, 2016 2:03 pm
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.
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Thu Feb 11, 2016 1:09 am
by xiaochris
Hi ,
I would just want to force the data source to appear from designer / viewer from code. How do i do it?
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Thu Feb 11, 2016 3:23 pm
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.
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Tue Feb 16, 2016 9:41 am
by xiaochris
Hi HighAley,
Do you have a sample project which hardcode mysql connection string into the reports
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Tue Feb 16, 2016 8:40 pm
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.
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Thu Feb 18, 2016 5:36 am
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?
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Thu Feb 18, 2016 1:00 pm
by HighAley
Hello.
You should put this code after loading of the report and before showing it.
Thank you.
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Fri Feb 19, 2016 1:30 am
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);
Re: Porting from Stimulsoft Reports PHP to Web
Posted: Fri Feb 19, 2016 6:28 am
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.