Setting parameter in precompiled reports
Posted: Fri Feb 15, 2013 10:06 am
Hi,
I have a report which uses data from a database connection. The queries of the datasources need some parameters which are defined as report parameters. I programmactically generate thousands of reports each day. The difference of these reports are the parameter values.
Imagine, loading thousands of reports, setting the parameter values, compiling the reports, rendering the reports and saving them as pdf dokuments ... This workflow takes a lot of time and maybe this is a waste of time when using precompiled reports.
I tested report generation with precompiled reports with simple report templates. This worked, but when increasing the complexity of the report it didnt' work any more.
In my project I loading the report like this (from http://admin.stimulsoft.com/Documentati ... _asse3.htm):
To reproducing this bug/issue you can find a c# project in the attachments. This project is from your sample projects (SqlParameters). I did some changes in the code to reproduce my issue. You can find my changes in this method from Form1.cs:
As you can read in my comment, when I do not load the report from the assembly, generating the reports works, but takes in my case too long. Loading the report from the assembly is rather fast, but doesn't work.
I hope I stated my issue/problem clear enough. In any case take a look at the c# project in the attachment.
Thx in advance, greetings
I have a report which uses data from a database connection. The queries of the datasources need some parameters which are defined as report parameters. I programmactically generate thousands of reports each day. The difference of these reports are the parameter values.
Imagine, loading thousands of reports, setting the parameter values, compiling the reports, rendering the reports and saving them as pdf dokuments ... This workflow takes a lot of time and maybe this is a waste of time when using precompiled reports.
I tested report generation with precompiled reports with simple report templates. This worked, but when increasing the complexity of the report it didnt' work any more.
In my project I loading the report like this (from http://admin.stimulsoft.com/Documentati ... _asse3.htm):
Code: Select all
C#
string reportName = "MyReport.mrt";
string reportDllName = "MyReport.dll";
StiReport report = null;
// if report dll is not exists ...
if (!File.Exists(reportDllName))
{
// load report definition
report = new StiReport();
report.Load(reportName);
// compile report, save dll version of report
report.Compile(reportDllName);
}
else // if report assembly is available …
{
// … use it
report = StiReport.GetReportFromAssembly(reportDllName);
}
Code: Select all
private void button1_Click(object sender, System.EventArgs e)
{
string reportDllName = "Report.dll";
stiReport1.Compile(reportDllName);
//without next statement report generating works!
stiReport1 = StiReport.GetReportFromAssembly(reportDllName);
for (int i = 0; i < lbCountries.Items.Count; i++) {
setParameter(lbCountries.Items[i].ToString());
stiReport1.Render(false);
Export(lbCountries.Items[i].ToString());
}
}
I hope I stated my issue/problem clear enough. In any case take a look at the c# project in the attachment.
Thx in advance, greetings