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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter with Null Value

Status
Not open for further replies.

dbant101

Technical User
Jan 29, 2007
21
CA
I am modifying a Crystal Report that shows posted transactions for a given weeks transactions. In the selection formula I use two parameter fields a Date from and a Date TO. The problem I am experiencing is to not have the user enter a date from and date to if they want to see all the transcations that occurred in the gl account. We are using Crystal reports version 7. The report is also based on a datapiped report. Any help would be much appreciated.
 
You need to set the default values to "All" for both FROM_DATE and TO_DATE. Then in the select expert, use a condition, something like this:
(
IF {?DATE_FROM} = "ALL" THEN {DATE_FROM} > ''
ELSE {DATE_FROM} = {?School_Number})
)
AND
(
IF {?DATE_FROM} = "ALL" THEN {DATE_FROM} > ''
ELSE {DATE_FROM} = {?School_Number})
)



 
I'm sorry, I just cut & paste from my test example. It should be:

(
IF {?DATE_FROM} = "ALL" THEN {DATE_FROM} > ''
ELSE {DATE_FROM} = {?DATE_FROM})
)
AND
(
IF {?DATE_TO} = "ALL" THEN {DATE_TO} > ''
ELSE {DATE_TO} = {?DATE_TO})
)


 
What is the datatype of your date field? Is it a date or a string?

-LB
 
Are you saying your database date field is a string, not a date? How does it display, i.e., what is the format? If the format is yyyymmdd, you could set up a default like "All" as suggested and then you could use something like:

(
If {?datefrom} <> 'All' then
{table.date} >= {?datefrom} else
if {?datefrom} = 'All' then
true
) and
(
If {?dateto} <> 'All' then
{table.date} <= {?dateto} else
if {?dateto} = 'All' then
true
)

If your field is a date, then change "All" to some date like date(9999,09,09) and change your parameter datatype to date.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top