Double Pass
Posted: Wed Oct 25, 2017 11:42 am
Hello.
In my report, there are five data sources. When the first data source is executed, if it brings data, the others must execute. Otherwise, the others should not run. I was able to do this by using the following code in the report's BeginRender event:
Page0.Enabled = false;
Page1.Enabled = false;
second_data_souce.ConnectOnStart = false;
third_data_souce.ConnectOnStart = false;
fourth_data_souce.ConnectOnStart = false;
fifth_data_souce.ConnectOnStart = false;
first_data_source.Connect();
if (first_data_source.Count == 0)
{
StiDataSource[] sds = this.Dictionary.DataSources.Items;
List<StiDataSource> lstDsForDelete = new Lis<StiDataSource>();
foreach (StiDataSource item in sds)
lstDsForDelete.Add(item);
foreach (StiDataSource itemRemove in lstDsForDelete)
this.Dictionary.DataSources.Remove(itemRemove);
Page0.Enabled = true;
}
else
{
second_data_souce.ConnectOnStart = true;
third_data_souce.ConnectOnStart = true;
fourth_data_souce.ConnectOnStart = true;
fifth_data_souce.ConnectOnStart = true;
Page1.Enabled = true;
}
The problem is that because of the double pass, the command first_data_source.Connect (); does not run again and ends up entering the if instead of entering the else. Is there any solution or other way to do it?
Thank you.
In my report, there are five data sources. When the first data source is executed, if it brings data, the others must execute. Otherwise, the others should not run. I was able to do this by using the following code in the report's BeginRender event:
Page0.Enabled = false;
Page1.Enabled = false;
second_data_souce.ConnectOnStart = false;
third_data_souce.ConnectOnStart = false;
fourth_data_souce.ConnectOnStart = false;
fifth_data_souce.ConnectOnStart = false;
first_data_source.Connect();
if (first_data_source.Count == 0)
{
StiDataSource[] sds = this.Dictionary.DataSources.Items;
List<StiDataSource> lstDsForDelete = new Lis<StiDataSource>();
foreach (StiDataSource item in sds)
lstDsForDelete.Add(item);
foreach (StiDataSource itemRemove in lstDsForDelete)
this.Dictionary.DataSources.Remove(itemRemove);
Page0.Enabled = true;
}
else
{
second_data_souce.ConnectOnStart = true;
third_data_souce.ConnectOnStart = true;
fourth_data_souce.ConnectOnStart = true;
fifth_data_souce.ConnectOnStart = true;
Page1.Enabled = true;
}
The problem is that because of the double pass, the command first_data_source.Connect (); does not run again and ends up entering the if instead of entering the else. Is there any solution or other way to do it?
Thank you.