Hi
How can I find out if a rendered report is empty?
I have designed some reports to be blank if the are data doesn't match the filters.
I don't want to check the data before rendering the report as the filters in the reports may change over time.
Have looked at some of the properties of the StimulReport object, but cant find what I need.
StimulReport.CompiledReport.TotalPageCount = 0 (are always 0)
StimulReport.CompiledReport.Pages.Count = 1
StimulReport.Pages.Count = 1
StimulReport.RenderedPages.Count = 1
Thanks
Detect if report is empty after rendering
Detect if report is empty after rendering
Hello,
As a way, you can check count of rendered pages:
StimulReport.RenderedPages.Count
Thank you.
As a way, you can check count of rendered pages:
StimulReport.RenderedPages.Count
Thank you.
-
- Posts: 31
- Joined: Thu Feb 17, 2011 1:54 pm
- Location: Cuiaba, Brazil
Detect if report is empty after rendering
Normally i just check if the datasets i used are empty (count), if so, on the summary i print a "nothing to see here" message.
Detect if report is empty after rendering
Hello,
As a workaround, you can do the following:
- define new variable in dictionary of the report, for example var1, type of int
- write the following code in the BeforePrint event of databand or headerband:
- use the following code for render report and get the variable value from the report:
Now the v1 variable contain a count of rows of DataBand1. If there is no data, count will be 0.
Please check the report sample with two variables in attachment.
Thank you.
As a workaround, you can do the following:
- define new variable in dictionary of the report, for example var1, type of int
- write the following code in the BeforePrint event of databand or headerband:
Code: Select all
var1 = DataBand1.Count;
Code: Select all
StiReport report = new StiReport();
report.Load("report.mrt");
report.Render();
int v1 = (int)report["var1"];
Please check the report sample with two variables in attachment.
Thank you.
- Attachments
-
- 1784.Report.zip
- (2.4 KiB) Downloaded 295 times