Compiled report question

Stimulsoft Reports.WEB discussion
Post Reply
jay@bplogix.com
Posts: 251
Joined: Fri Feb 04, 2011 11:46 am
Location: San Diego, CA

Compiled report question

Post by jay@bplogix.com »

After I call GetReportFromAssembly to load a pre-compiled report, can I add variables, and datasources via C# still? Or is that only available for reports that load .MRT files?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Compiled report question

Post by Alex K. »

Hello,

You can use the following code:

Code: Select all

report.Dictionary.Variables.Add();
report.Dictionary.DataSources.Add();
Thank you.
jay@bplogix.com
Posts: 251
Joined: Fri Feb 04, 2011 11:46 am
Location: San Diego, CA

Compiled report question

Post by jay@bplogix.com »

That does not seem to work for compiled reports.
No matter what variables I add/change, running a compiled report does not see the variables. I have tried changing the variables value in the report.Dictionary.Variables collection in the dictionary, and the running report does not see the changes.

I am just placing a variable in the header like this {var1}

I even do a
report.Dictionary.Variables.Clear();
but when I run the report it still "sees" the variables that were there when the report was compiled (I would have expected a runtime error).

Setting/changing variables works perfectly when I use report.Load, so are you sure StiReport.GetReportFromAssembly supports changing variables after a compiled report (.dll) is loaded?

Jay
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Compiled report question

Post by Alex K. »

Hello,

In this case, you can use the following code to get access to variables or datasources:

Code: Select all

report["Variable1"] = ;
report["DataSourceName"] = ;
...
Thank you.
jay@bplogix.com
Posts: 251
Joined: Fri Feb 04, 2011 11:46 am
Location: San Diego, CA

Compiled report question

Post by jay@bplogix.com »

That syntax for variables seems to work better ... but it only allows setting of strings (instead of StiVariable). I have A LOT of logic that manipulates the variables collection with code like this:
report.Dictionary.Variables[TempName] = new StiVariable(null, TempName, TempName, typeof(string), entry._sText, true);

Is there any reason manipulating the report.Dictionary.Variables directly does not work for compiled reports?

Thanks,
Jay
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Compiled report question

Post by Ivan »

Hello,

[quote="jay"@bplogix.com]That syntax for variables seems to work better ... but it only allows setting of strings [/quote]
We couldn't reproduce this bug.
Can you please send us a simple test project, which reproduce the issue?

[quote="jay"@bplogix.com]Is there any reason manipulating the report.Dictionary.Variables directly does not work for compiled reports?[/quote]
In compiled report all variables are compiled to class members, so you can not override them.

Thank you.
Post Reply