Solved

Check for DataSource before sub report load

Posted on 2004-09-21
8
467 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 10

Expert Comment

by:ebolek
Comment Utility
Good luck
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

17 Experts available now in Live!

Get 1:1 Help Now