Page 1 of 1
Compiled report question
Posted: Thu May 26, 2011 12:38 pm
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?
Compiled report question
Posted: Fri May 27, 2011 8:25 am
by Alex K.
Hello,
You can use the following code:
Code: Select all
report.Dictionary.Variables.Add();
report.Dictionary.DataSources.Add();
Thank you.
Compiled report question
Posted: Fri May 27, 2011 12:03 pm
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
Compiled report question
Posted: Mon May 30, 2011 9:18 am
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.
Compiled report question
Posted: Tue May 31, 2011 8:59 pm
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
Compiled report question
Posted: Sun Jun 05, 2011 3:52 pm
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.