Solved

Parameter Validation in Crystal Reports

Posted on 2004-09-16
9
1,819 Views
Last Modified: 2011-10-03
Hi,
Is there a way we could validate the parameter values in Crystal report. For example one of the reports I have takes the start date and end date as parameters. After the user enters the start date and end date and before runnign the query is there way I could check if the end date is less than the start date.

I would like to do this

Take user parametrs
 if  end_date < start_date
  prompt the user to enter valid parameters
else
 go ahead and execute the query.


Thanks,
Nila
0
Comment
Question by:nila
9 Comments
 
LVL 28

Expert Comment

by:bdreed35
ID: 12078653
You can validate the parameters and override the end_date, but you cannot prompt the user to reenter then end_date, at least not without creating a custom front end.

This 3rd party software might be an option for you:
http://www.milletsoftware.com/DataLink_Viewer.htm

I can give you an example of validating the parameters in Crystal alone if you like, just let me know.
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12078656
the only way to accomplish that is to do it in an application . Then you can do that. you check in your application if the end date > start date and pass it to the query otherwise ask the user to enter the parameetr again.

Regards
Emre
0
 
LVL 42

Expert Comment

by:frodoman
ID: 12078845
Something I've done before is to write a selection formula that will look at both dates and handle the earliest as the start date and the latest as the end date -- this isn't very efficient but it allows your report to run even if the user enters the dates in the wrong order.  If that's something you want to pursue I can help with that, otherwise (as already said) you'll need to write your own front end or use a 3rd party package.

frodoman
0
 
LVL 26

Accepted Solution

by:
Kurt Reinhardt earned 250 total points
ID: 12079202
I'm surprised that nobody has mentioned this, but here goes:

1)  Modify your record selection criteria to validate the data parameters entered:

(
If
  {?Thru Date} >= {?From Date}
Then
  {Table.Date} In {?From Date} To {?Thru Date}
Else If
  {?Thru Date} < {?From Date}
Then
  False
)

2)  Insert a second Report Header (Report Header b)

3)  Insert the following message into a Text Box in Report Header b:

The 'Thru Date' parameter of ?Thru Date is < the 'From Date' paremter of  ?From Date.  Please run the report again.

4)  Conditionally Suppress Report Header b where {?Thru Date} >=  {?From Date}

5)  If you want, conditionally suppress other sections you want with the condition {?Thru Date} < {?From Date}

Voila!  The report won't return any data (unless you have records where the End Date < Begin Date) and the users will be prompted to run the report again!

~Kurt


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 42

Expert Comment

by:frodoman
ID: 12079216
Nice idea, Kurt. - frodoman
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 12079242
BTW, the message should read:

The 'Thru Date' parameter of {?Thru Date is} < the 'From Date' paremter of  {?From Date}.  Please run the report again.

You'll need to create the text and then insert the parameters in the appropriate place.  You'll also need to format the parameters so that the dates appear as you'd like, ala:

The 'Thru Date' parameter of 09/15/2004 < the 'From Date' paremter of  10/01/2004.  Please run the report again.
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 12079253
Thanks frodoman:)
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 12079298
btw, the message text is 'parameter', not paremter (sigh).

I've used this method quite a bit.  I actually require all of my report developers to include an intelligent 'No Data Found...'-type message in all of their reports.  In my experience, users equate a blank report to a broken report.  By having the report clearly state that there is no data for the combination of parameters entered, I mitigate the risk of unecessary support calls.
0
 

Author Comment

by:nila
ID: 12079321
I agree. I have the No Data Found for the search criteria you have entered too. It elimiates many of the questions from user.

Thanks,
Nila
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

Title # Comments Views Activity
Crystal suppressing if sub report empty 8 60
Converting int to currency 5 31
Crystal Reports Sub Report 4 79
Crystal Report GH Suppress Formula not acting as expected 10 28
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

16 Experts available now in Live!

Get 1:1 Help Now