List of variables from report

Stimulsoft Reports.Flex discussion
Locked
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

List of variables from report

Post by Chipo »

Hi,

I created some variables for the report (Designer->Dictionary->Variables ...)
Is there any way to get list of variables defined in the report on the runtime when I display the report?

Best regards
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: List of variables from report

Post by Vladimir »

Hello,

Please see the attached sample project:
Sample.zip
(23.45 KiB) Downloaded 462 times
Thank you.
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Re: List of variables from report

Post by Chipo »

Hi,

thank you for response. I can change the variable now.
Small question: How I can rerun report in the same viewer after changing the variables?

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

Re: List of variables from report

Post by HighAley »

Hello.

You could use next code:

Code: Select all

viewer = report.showDialog();

.....

report.isRendered = false;
viewer.report = report;
Thank you.
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Re: List of variables from report

Post by Chipo »

Hi,

thank you for response. In fact I did the following and it worked

Code: Select all

reportViewer.report.isRendered = false;
reportViewer.report.render(false);
reportViewer.report.show(reportViewer);
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Re: List of variables from report

Post by Chipo »

Hi,

I have report SQL query like that

Code: Select all

... and (primarycity in ({Suburb})) ...
when I updated variable

Code: Select all

reportViewer.report.variables["Suburb"] = "Bondi Junction";
it arrives to the server side as following
... and (primarycity in (Bondi Junction)) ...


when I updated variable

Code: Select all

var values: Array = [];
values.push("Bondi Junction");
values.push("DRUMMOYNE");
reportViewer.report.variables["Suburb"] = values; 
it arrives to the server side as following
... and (primarycity in (Bondi Junction,DRUMMOYNE)) ...


when I updated variable

Code: Select all

reportViewer.report.variables["Suburb"] = "'Bondi Junction'";
it arrives to the server side as following
... and (primarycity in (\'Bondi Junction\')) ...


when I updated variable

Code: Select all

var values: Array = [];
values.push("'Bondi Junction'");
values.push("'DRUMMOYNE'");
reportViewer.report.variables["Suburb"] = values;
it arrives to the server side as following
... and (primarycity in (\'Bondi Junction\',\'DRUMMOYNE\')) ...

I checked the content before real query execution in ReturnXmlOrSqlData.processLoadData() method.

For some reason you escaped the single quotation sign in both array and single value and do nothing if quotation absent.

How I can avoid this quotation escape during the setup of the variable on the flex side?
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: List of variables from report

Post by Vladimir »

Hello,

You can use this option:

Code: Select all

StiOptions.engine.escapeQueryParameters = false;
Thank you.
Locked