Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank Parameter

Status
Not open for further replies.

dciadmin

IS-IT--Management
May 10, 2002
34
0
0
Hi,

Using Crystal Reports 9, I have two parameters setup ... one is for a string and one is a date. I added these to the Select Expert and if they are both filled out by the user then the report works fine ...

What I need to do is have the option to leave the date blank and have the report pull all the dates instead of just one specific one. I read something about making the date parameter into a string and then converting it afterwards but I really would like the user to be able
to choose a date from a "calendar" versus having to type it in ...

So to recap ... the user fills out his order number in the string field and then either hits ok (leaving the date parameter empty) to get that order number with all dates, or he highlights the date parameter and can drop down the box to choose the date.

Seems straightforward but I am not getting it .... Tried this but it came up empty if the date was ignored ..


{co_ship.co_num} like "*"+{?Order Number} and
if(isnull({?Shipped Date})) then {do_hdr.shipped_date} =
AllDatesToToday else {do_hdr.shipped_date}={?Shipped Date}


any insight is appreciated ...


JL


 
Try using the following code, i think the reason its not working is because you haven't checked for a blank value only a null value.

if(isnull({?Shipped Date})) or {?Shipped Date} = "" then {do_hdr.shipped_date} <= today else {do_hdr.shipped_date}={?Shipped Date} and
{co_ship.co_num} like "*"+{?Order Number}


HTH

-Steve


"if at first you don't succeed, sky diving is not for you"!!! :eek:)
 
Hi Steve,

thanks for the reply ...

it gives me an error on this part of your formula ..

or {?Shipped Date} = ""

This is because it is setup to be a Date parameter and not a String. I could probably set it up as a string and then test against "" but then the user would have to type the date in instead of choosing it.

JL
 
I've run into the same problem. I've created a (?date type) parameter with default string values (ie first quarter, year to date, or date range...). Then I have a (?start date) and (?end date) parameters set up as dates. In your formula, use something to this effect:

if {?Date Type} = 'Date Range' then
({DATE}) > ({?Start Date}-1) and
({DATE}) < ({?End Date}+1))

When users choose date range from the date type parameter, it prompts them to enter the start and end date from a calendar view.

Hope that helps!
CJ
 
Hey CJ,

following your example I created the {?Date Type} parameter with "All" and "Choose Date" .. and modified my code to be this:

{co_ship.co_num} like "*"+{?Order Number} and
if {?DateType}= "All" then {do_hdr.shipped_date} <= today else if {?DateType}= "Choose Date" then {do_hdr.shipped_date}={?Shipped Date}

Problem is getting it to prompt for the date .. if I "Choose Date" in the {?DateType} parameter first then it relies on the user to then click on the {?Shipped Date} parameter and then enter the date they want. If they forget to do this it always gives them today's date

Do you somehow have the date range automatically prompting the user or do you first have to click on the datetype and then click on each of the two date ranges?
 
I don't appear to have any defaults on the any of them except the DateType .. which I have "All" and "Choose Date"

And then I have all three parameters show up when you run the report so I have the ShippedDate ordered last
 
You would need to have an additional parameter.

So, you have the first one asking for your string value.
The 2nd parameter asks for the date type.
The 3rd one is a shipped date parameter. If the date type of 'all' is chosen, then your formula will pull everything, and will ignore the 3rd parameter. But, if 'Choose Date' is chosen, then it won't let the user run the report without selecting a date...
 
Hi CJ,

Not having any luck getting it to prompt me for the date. I must be missing something (or maybe we have different versions?? ... I am using version 9)

My first parameter asks for my string value (the order num)
2nd one asks for date type
3rd is the shipped date parameter

I fill the first one out and then click down to choose the second one ... if I choose "All" it will give me all of the dates just fine. If I choose "Choose Date" and THEN actual click down to the third parameter and choose a date then it works fine. If I forget to do this though it will run the report with today's date (I don't see any defaults on the parameter).

So basically if I click down onto the 3rd one and choose a date it works fine but I can't get it to just prompt me for one automatically. Which may be just fine ... your routine works MUCH better then what I had before and I thank you for all the help!!

JL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top