Crystal Decisions: Determine Record Count of Data Set used by report at runtime

I am running a report using .Net/C#/Crystal Decisions.  The report is loaded, assigned parameters, and either printed or exported entirely in code.  I need to find a way to check the Record Count of the Data Set returned by the view at runtime to determine whether or not to skip printing/exporting of the report.  I am using ReportDocument to handle the execution of this report.  I have looked as deep into ReportDefinition and other parameters as I can find documentation for.

Does anyone know how to access this number at runtime?  If not, do you have any ideas for other methods of determining if the report will be blank?  I've considered opening the DataDefinition and extracting the selection criteria used by the report but this will be very heavy on execution as it will require 2 large hits to the database should data exist.  I've also looked at taking this first initial query and passing it back to the report as the dataset if data exists, but this doesn't sound like it will run well for me.

Thoughts?  Ideas?

This is my first question posted at EE so I'm giving all my intial 125 points for the answer.  Please be kind with your responses.  I hope to be able to pay more after I earn some more points in the future.
LVL 1
SevnnAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
Check the report options to see if there is an option to not print if no records.

mlmcc
0
ebolekCommented:
well dataset idea will work. That is one solution. I have never tries to get in the recordset of the reportdocument and i am positive that you cant. If you want to do that you should use push method (dataset) not pull method. There is nothing in the engine object model that is refering to as recordcount. However there is recordcount property of the crystal reports. And you should be able to access that. But maybe not in the version of .net bundled one. They have limited accessing the objects for .net and want you to buy the enterprise version :(

Regards
Emre
0
SevnnAuthor Commented:
mlmcc, I've seen this option but I am typically using ExportToStream, rarely if ever Printing.  I have to support both but the export side is used much more heavily.

ebolek, can you suggest any examples of push methods?  I've seen a few but they are usually pretty hacky.  I need to make sure it will work regardless of selection criteria and I will be running many different reports.  It will be a tremendous amount of work for me if I have to re-write any of the reports to get them to work with push instead of pull.  Is there another version of CR that supports a recordcount parameter?

Thanks guys, but I'm hoping there is a better solution.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

EwaldLCommented:
I have been unable to find a way to obtain the record count directly from a report within .net.

Not sure if this  would help you, but this article shows how you can obtain the number of pages from a report. So if you could design your reports in a way that each report without data will have 1 page only, and where each report with 1 record or more will automatically go over 2 pages then you would have a solution where you can stick to your current connectiviy model.
http://support.businessobjects.com/library/kbase/articles/c2013559.asp
0
ebolekCommented:
I dont know any version that supports the record count
Datasets are as you said not easy to implement but it gives you great flexibilit yon the recordset because you get the recordset programatically. These are the steps required to implement a dataset in areprot

1. Create a stored procedure, viewe etc to get the data from db
2. Create a dataset with the sp you just created
3. Write an app, to fill the dataset. Now the dataset has the necessary data filled
4. Create your report with the dataset as its source
5. Set the report source runtime witht he filled dataset.
6. Show the report

There is a dataset example in business objecs. Read this
http://support.businessobjects.com/communityCS/TechnicalPapers/rtm_reportingoffadonetdatasets.pdf.asp

Hopefully it helps
Regards
Emre
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EwaldLCommented:
You coudl use the craxdrt to obtain the recordcount, but I would not recommend this for a web application (it's not scalable) and I would not like to use it in .NET either (not meant to be used this way, you would not  use the .net assemblies)

but anyway, this code would get the value. it has to be executed though once the report has been fully formatted
MsgBox  crReport.PrintingStatus.NumberOfRecordSelected
0
SevnnAuthor Commented:
I was hoping for a solution that did not require pushing a dataset into the report object.  I am looking into the Enterprise versions of CR.  If they do not support it or of they are out of my $ range I will be attempting the push method (but only as a last resourt).

Thanks everyone for your input.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.