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

Blank entry for report parameter and setting to current date

Status
Not open for further replies.

LinPro

Programmer
Jun 25, 2003
120
US
Hi
CR 2008
Oracle 10g

I have a data parameter that is set to Optional Prompt. So, in the Record Selection Criteria:
(
{CreateDate} = not hasValue({?DateRange})
or {CreateDate} = {?DateRange}

)

However, I need:
if not hasValue({?DateRange}) = True
//when dateRange is left blank.
then {CreateDate} = currentdate - 30
else
{CreateDate} = {?DateRange}

L

Can this be done?
 
Hi Ian

The second part is a formula.

Error .... Needs a date.
 
YOu parameter name implies a range, whereas the first operation

then {CreateDate} = currentdate - 30

is only a single date.

Change your parameter to discrete value only.

Ian
 
I did that and still it does not work properly.

IF not HasValue({?Created On})
then CurrentDate - 30
else {Command.Created On} = {?Created On}

It said {Command.Created On} = {?Created On} needs a date again.
 
Is {command.created on} a string? Please verify the datatype.

-LB
 
Hi All

I already figured how to handle this. Thx.

It is not a string - but a date.

L
 
Please explain the solution, so others can benefit.

-LB
 
Create Two Parameters:
Begin Created On
End Created On

Create 2 formulas:

IF not HasValue({?Begin Created On})
then CurrentDate - 30
else {Command.Created On}
else {?Begin Created On}

IF not HasValue({?End Created On})
then CurrentDate + 30
else {Command.Created On}
else {?End Created On}

Then for Record Selection:
{Command.Created On} >= {@Begin CurrentDate}
and
{Command.Created On} <= {@End CurrentDate}

This idea works for Strings as well.
 
Hmmm. I don't believe you can have two "elses" in an if/then without another if/then. Perhaps you could double check those formulas. But thanks for explaining.

-LB
 
Sorry. I didn't realize I put two else.... here is it again

Create Two Parameters:
Begin Created On
End Created On

Create 2 formulas:

IF not HasValue({?Begin Created On})
then CurrentDate - 30
else {?Begin Created On}

IF not HasValue({?End Created On})
then CurrentDate + 30
else {?End Created On}

Then for Record Selection:
{Command.Created On} >= {@Begin CurrentDate}
and
{Command.Created On} <= {@End CurrentDate}

This idea works for Strings as well.

 
Hi LB

no pblm. I should have looked it over before posting.

L
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top