Page 1 of 1

Pass value to report variable

Posted: Mon Apr 04, 2016 12:50 pm
by felipemoreira
Hi again.

This code works on .net product :

Code: Select all

StiReport report = new StiReport();
report.Load(path);
report.Compile();
report["param_1"] = 33;
report.Render();
Where" param_1" is the name of my variable created on report.
How can i do that on js product ? I did not find in the documentation.

Re: Pass value to report variable

Posted: Mon Apr 04, 2016 2:16 pm
by HighAley
Hello.

The same code in Reports.JS will be like this:

Code: Select all

// Create the report viewer with default options
var viewer = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
// Create a new report instance
var report = new Stimulsoft.Report.StiReport();
// Load report from url
report.loadFile("../reports/listadoPrueba.mrt");
report.dictionary.variables.getByName("param_1").valueObject = "your value";
// Assign report to the viewer, the report will be built automatically after rendering the viewer
viewer.report = report;
Thank you.

Re: Pass value to report variable

Posted: Mon Apr 04, 2016 4:18 pm
by felipemoreira
It worked, thanks again Aley!

Re: Pass value to report variable

Posted: Tue Apr 05, 2016 8:04 am
by HighAley
Hello.

We are always glad to help you.
Let us know if you need our help.

Thank you.