Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Missing Parameter Value Post Reply Post New Topic
Author Message
hnguyen
Newbie
Newbie


Joined: 16 Feb 2010
Location: United States
Online Status: Offline
Posts: 1
Quote hnguyen Replybullet Topic: Missing Parameter Value
    Posted: 16 Feb 2010 at 8:47am
Hi all,

I am using CR 2008 for Visual Studio. I have an application that opens a report file, sets the parameters, and exports the file to a .pdf file. This file then gets emailed.

What I want to accomplish is to not send the email if the report has no data.

I have a couple of different scenarios. The report calls a stored procedure with the parameters. There is also a sub report that uses the same parameters but calls a different stored procedure. It is possible for the main report to have records and the subreport to not have records. It is also possible for the main report to not have records but the subreport to have records. I only want to suppress the email if both the main and sub reports have no data.

When I first saw the .hasRecords property of the ReportClass and the ReportDocument I thought that was the exact thing I needed. However, if there are no records in the main report, accessing this property throws an exception saying something like "missing parameter information". Also, accessing ReportDocument.hasRecords says that it isn't supported for sub-reports.

There is also a .rows property but that always contains 0 items in the collection for ReportClass and also says that it isn't supported for sub reports in the ReportDocument class.

I could not find documentation anywhere on the ReportClass.hasRecords property. What I found for the ReportDocument.hasRecords property states that it can be used to prevent the display of an empty report to the user and allow the program to prompt for different parameters. This is just what I want to do but the properties don't seem to be working the way one would expect.

Can anyone shed any light on the .hasRecords property or suggest a way for me to know if either the main report or the sub report has any data?

Thanks in advance.

David
KNg
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 Feb 2010 at 6:54am
since you are using stored procs, you should be able call the stored procs and count the records.  Better yet, combine the output of the stored procs into 1 (you can keep it as 2 datatables), get the data via a call in the application and push the data to the report.  Since you control the data, you can see if anything is there, and if nothing is there, don't call the report.
 
HTH
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.