As detect whether a report has information

Stimulsoft Reports.NET discussion
Post Reply
pca
Posts: 14
Joined: Fri Nov 30, 2007 1:44 pm

As detect whether a report has information

Post by pca »


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

Thanks
Patricio
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

As detect whether a report has information

Post 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.
pca
Posts: 14
Joined: Fri Nov 30, 2007 1:44 pm

As detect whether a report has information

Post 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.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

As detect whether a report has information

Post by Edward »

Please use DataSource.Count property for analysis of the records count in the DataSource.

Thank you.
pca
Posts: 14
Joined: Fri Nov 30, 2007 1:44 pm

As detect whether a report has information

Post 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.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

As detect whether a report has information

Post 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.
pca
Posts: 14
Joined: Fri Nov 30, 2007 1:44 pm

As detect whether a report has information

Post by pca »

Thank you.
I have already solved
Patricio
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

As detect whether a report has information

Post by Edward »

Please let us know if any help is required.

Thank you.
Post Reply