Page 1 of 1

As detect whether a report has information

Posted: Tue May 06, 2008 8:13 am
by pca

I need to detect whether the report brings information, in order not to show blank sheet

Thanks
Patricio

As detect whether a report has information

Posted: Tue May 06, 2008 9:53 am
by Vital
Hello Patricio,

You can use following code:

Code: Select all

report.Render();

bool reportIsEmpty = report.RenderedPages.Count == 1 && report.RenderedPages[0].Components.Count == 0;

if (!reportIsEmpty)report.Show();
Thank you.

As detect whether a report has information

Posted: Tue May 06, 2008 11:10 am
by pca
Hello Vital.

It does not work if there objects texts in the report.

The Report.RenderedPages[0].Components.Count returns greater than zero

I'm interested detect whether datasource returns data

Thank you.

As detect whether a report has information

Posted: Tue May 06, 2008 2:31 pm
by Edward
Please use DataSource.Count property for analysis of the records count in the DataSource.

Thank you.

As detect whether a report has information

Posted: Tue May 06, 2008 3:34 pm
by pca
Sorry my English is not good, I will try again to explain my query

The report.Datasource.count, only indicates amount DataSource in the report. What we need is whether after report.render, the DataSource of the report returned information

Thank you.

As detect whether a report has information

Posted: Tue May 06, 2008 6:13 pm
by Edward
Sorry for unclear answer. Let's suppose that Categories is one of the DataSources from the report's Dictionary.
I meant to use the expression:

{Categories.Count}

instead of

{report.DataSources.Count}

First expression means amount of records in Categories DataSource, second expression means a quantity of DataSources in the Dictionary of the report.

Thank you.

As detect whether a report has information

Posted: Wed May 07, 2008 11:04 am
by pca
Thank you.
I have already solved
Patricio

As detect whether a report has information

Posted: Wed May 07, 2008 1:25 pm
by Edward
Please let us know if any help is required.

Thank you.