Solved

Check for DataSource before sub report load

Posted on 2004-09-21
8
472 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
8 Comments
 
LVL 101

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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 10

Expert Comment

by:ebolek
ID: 12122399
Good luck
0
 
LVL 101

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

687 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