Pass value to report variable

Stimulsoft Reports.JS discussion
Post Reply
felipemoreira
Posts: 38
Joined: Wed Mar 30, 2016 1:52 pm
Location: Brazil

Pass value to report variable

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Pass value to report variable

Post 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.
felipemoreira
Posts: 38
Joined: Wed Mar 30, 2016 1:52 pm
Location: Brazil

Re: Pass value to report variable

Post by felipemoreira »

It worked, thanks again Aley!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Pass value to report variable

Post by HighAley »

Hello.

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

Thank you.
Post Reply