And when would that happen in the process of load/compile/render?
I've put together the following code based on examples and am not sure if it's correct, or whether I need the parameter loop given that the only variables we use are tied to parameters. Maybe better safe than sorry and do both? Or would that make the page load slower/less efficient?
Code: Select all
StiReport oReport = new StiReport();
oReport.Load(sReport);
foreach (StiSqlDatabase oConnection in oReport.Dictionary.Databases)
oConnection.sConnectioning = sConnection;
oReport.Compile();
foreach (StiVariable oVariable in oReport.Dictionary.Variables)
{
string sValue = oParams[oVariable.Name];
if (!String.IsNullOrEmpty(sValue))
{
try
{
object castValue = TypeDescriptor.GetConverter(oVariable.Type).ConvertFromInvariantString(sValue);
oReport.CompiledReport.Variables[oVariable.Name] = castValue;
}
catch (Exception) { }
}
}
/* Do we need to do BOTH variables AND parameters loops? < ----------------------------------------------------------
foreach (StiDataSource oDatasource in oReport.DataSources)
{
foreach (StiDataParameter oParameter in oDatasource.Parameters)
{
string sValue = oParams[oParameter.Name];
if (!String.IsNullOrEmpty(sValue))
{
try
{
object castValue = TypeDescriptor.GetConverter(oParameter.Type).ConvertFromInvariantString(sValue);
oParameter.ParameterValue = castValue;
}
catch (Exception) { }
}
}
}
*/
oReport.Render(false);
StiWebViewer1.Report = oReport;
oReport.Dictionary.DataStore.Clear();