Solved

Check for DataSource before sub report load

Posted on 2004-09-21
8
468 Views
Last Modified: 2008-03-03
Hi,
I am trying to build a report that has multiple subreports.  The datasource for the sub reports is a series of CSV files (using an odbc connection).  The csv files are created by a third party program that performs exports to csv.  If the export is run by the users and there is no data it creates an empty csv file.  That file is then read by Crystal Reports (8.5) and the sub report fails. The sub reports called after it also fail.  I am wondering if there is a way in Crystal Reports to create a check for the datasource before the sub report loads.  It would be ideal if I could check and if the data source does not exist cancel the load of that subreport, thus allowing a load of the next subreport.

Is this possible in Crystal reports?  I have seen the Alert feature, but I am not sure how to check for the health of the data source.

Any help you could give would be much appreciated.

Casey
0
Comment
Question by:Casey Santos
  • 3
  • 2
  • 2
8 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 12119818
I can't think of any way to do that without using some kind of front end application or perhaps another csv files that has the count of the records in the various other csv files.

You could then use that information to suppress a given subreport.

mlmcc
0
 
LVL 10

Accepted Solution

by:
ebolek earned 25 total points
ID: 12122121
You can simple do it in an application like this

1. Create  windows or web form
2. Insert a crystal web/windows viewer to the form
3. Create a dataset and use that dataset as your report;s datasource.
4. Load the dataset with data
5. You cehck if the report's dataset is empty. If it is you exit the application, if not bind the datset to the report documeny and load the dataset tothe reportviewer.

Regards
Emre
0
 

Author Comment

by:Casey Santos
ID: 12122344
I am avoiding using a separate application because the Crystal Report file already is being used through a viewer in the Third Party application.  We would like to keep it as integrated as possbile for the users.


mlmcc, I would be interested to know how you would use a separate CSV file to count the records in the other files.  How would you suppress the subreport then?

Thanks,
Casey
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Expert Comment

by:ebolek
ID: 12122399
Good luck
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 100 total points
ID: 12122542
As ebolek says, this may be difficult.  I will need to think this through and need more information

First - I suspect you cannot change the exporting routines.  

Is there a main report that has a dataset?  If so is there any indication in that data that a subreport is empty? I doubt it.

How many subreports?  Is this a single report or is this something you want need for many reports?

Main basic idea is to use variables which are set from the new dataset.  The variables are then used to suppress a subreport if the dataset is empty.

Can you try something to see if this idea might work?
Take a set of the csvs with a known empty dataset.
Suppress the related subreport and see if the report runs.

mlmcc
0
 

Author Comment

by:Casey Santos
ID: 12128313
mlmcc, I think you have got it.  We have tried to surpress one of the subreports and then emptied the csv file.  The entire main report runs and skips the surpressed subreport.  So now we are going to create a different csv file datasource that reads all of the other csv files, checking them for data.  A flag will be set for each csv file that is missing data.  We will then use the csv file with these flags to set the surpression of each of the respective subreports.  We will do this tomorrow and let you know how it goes.

Thanks,
Casey
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12338694
I think both mlmcc and I gave the right answers. He could use both explanations so I recommend mlmcc & ebolek

Comment from ebolek
Date: 09/22/2004 05:31AM PDT
Comment from mlmcc
Date: 09/22/2004 06:20AM PDT
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now