how to detect empty report
how to detect empty report
Hi,
I am testing to generate report from database using dynamic query. Sometime, the query will not return any data and then if I export the data as image, I will get image with no data on it. Is there a way that I can detect when there is no data returned from the query?
thanks,
sw
I am testing to generate report from database using dynamic query. Sometime, the query will not return any data and then if I export the data as image, I will get image with no data on it. Is there a way that I can detect when there is no data returned from the query?
thanks,
sw
how to detect empty report
Please use IsEmpty property of the Datasource.
Thank you.
Thank you.
how to detect empty report
Thank you, Edward,
When should I check the IsEmpty property? It always return false when I check IsEmpty after call to render(). Could you please provide some code snippet?
sw
When should I check the IsEmpty property? It always return false when I check IsEmpty after call to render(). Could you please provide some code snippet?
sw
how to detect empty report
Please inform me when do you want to check a query? After rendering the report or in the code of the report to make a decision to render something or not?
In other words what is the goal of the checking a query?
Thank you.
In other words what is the goal of the checking a query?
Thank you.
how to detect empty report
In my application, I need to export pdf report at predefined time intervals. The data were retrieved from a database. Some times, the sql query defined in datasource of the report does not contain any data. In that case, I do want to generate a report without any data. The question is how to determine whether a report has any data or not.
sw
sw
how to detect empty report
Please do the following steps:
1. Define a variable in the Dictionary of the report with bool type. For example IsReportHasData.
2. In the BeforePrint event of the page of the report please add the following code:
3. In your Application please check this variable after rendering the report:
Thank you.
1. Define a variable in the Dictionary of the report with bool type. For example IsReportHasData.
2. In the BeforePrint event of the page of the report please add the following code:
Code: Select all
IsReportHasData = !Categories.IsEmpty;
Code: Select all
report.Render();
if ((bool)report["IsReportHasData"] == true)
{
MessageBox.Show("DataSource is not empty");
}
else
{
MessageBox.Show("DataSource is empty");
}
how to detect empty report
Hi edward, this case and solution is close to my problem at hand.
My case is to determine
If a table.column has a value/is not empty
then proceed on printing report
Else display a warning on a message box like "Data on column_name is not existing. Pls. correct"
May i know your thoughts on doing it?
Thx.
My case is to determine
If a table.column has a value/is not empty
then proceed on printing report
Else display a warning on a message box like "Data on column_name is not existing. Pls. correct"
May i know your thoughts on doing it?
Thx.
how to detect empty report
I added some codes on the Page BeforePrintEvent:
how will i do that?
Thanks!
And on AfterPrintEvent:if (Table.Column == null){
MessageBox.Show("Data on column_name is not existing. Pls. correct");
Page1.Enabled = false;}
THis shows the message box okay but I should not set Page1.enabled = false because the report still needs to be printed (labels, etc.) except the fetched data.Page1.Enabled = true;
how will i do that?
Thanks!