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

Formula to select date range in select expert 1

Status
Not open for further replies.

sniggih

Technical User
Jan 23, 2002
22
0
0
US
I would like to be able to include a formula in the select expert that will allow the user to select if they would like to run the report based on a default date parameter (?Default Date or Select Date) or if they would like to select their own date range.

Under the (?Default Date or Select Date)parameter I have set up two options…"Standard Date" and "Select Date".

If the user selects "Standard Date" the formula will need to select current date less 4 months for the end date and less 16 months for start date. The catch to that is it will be selecting on Incurred_period, which is always the end of the month for the month the claim was incurred. So in my formula below I was trying to subtract 3 months, make the date the first of the month and then subtract a day. Thus always giving me the end of the month for 4 months prior to the current month for end date. For example if the user ran this report today using the “Standard Date” the formula should take May 28, 2002…change it to the first of the month (May 01, 2002) and subtract three months (February 1, 2002) then subtract 1 day (January 31, 2002)for end date. The start date would be the same except instead of subtracting 3 months it would be 15 months.

If “Select Date” were chosen the user would use the parameter set up to select desired date range and the formula would use those parameters instead of using the calculation referenced above.

Here is what I am using in the select expert.

Datevar MD;

MD := Date(Year(CurrentDate),Month(CurrentDate),01)-1;


if {?Default Date or Select Date} = 'Standard Date' then {profile:_Stage_II.Inc Period} in
Dateadd("M",-3,MD) to Dateadd("M",-15,MD)
else {profile:_Stage_II.Inc Period}
in {?Start Date} to {?End Date}

Here is the error I got back.

A boolean is required here.

Is there a way around this?



 
Get rid of your variables:

if {?Default Date or Select Date} = "Standard Date" then {profile:_Stage_II.Inc Period} in
Dateadd("M",-3,Date(year(CurrentDate),month(Currentdate),1)-1 to Dateadd("M",-15,Date(year(CurrentDate),month(Currentdate),1)-1
else
{profile:_Stage_II.Inc Period} in {?Start Date} to {?End Date}

Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top