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

Duration Parameter

Status
Not open for further replies.

skurkal

IS-IT--Management
Apr 6, 2005
37
US
Hi All,

I am using CRXI and have a report that has the startdate and EndDate as parameters, which is then passed to a command. Now I have to add another parameter (Duration)which will automatically set the startdate and the enddate values. The duration parameter will have 3 choices,

Daily,
Weekly and
Monthly.

If the user chooses 'Daily' the startdate parameter should automatically have CurrentDate-1 and Enddate parameter should have the CurrentDate value in it and so on for weekly or montly.

In effect I want to supress the existing startdate and enddate parameters and have them automatically populate depending on the duration choosen.

Thanks in advance for your help,
Sumitra.
 
Delete the existing parameters.

Create the new parameter with the 3 choices in the picklist.

Use the following in your record selection formula:

if {?Duration} = "Daily" then {DateField} > currentdate-1
else if {?Duration} = "Weekly" then {DateField} > currentdate-7
else {DateField} > DateAdd("m",-1,currentdate)
 
Unfortunately this does not work if I have to pass the Startdate and EndDate as parameters to the command. Also the main report also has a subreport to which the same evaluated startdate and enddate (based on duration) needs to be passed.
 
Why MUST you use the startdate and enddate parameters? Eliminate them and replace them as groggle suggests. You can set up the duration parameter within the command--you just then need to use the equivalent of currentdate for your particular datasource, which you should identify for us.

You can set up the subreport with the same duration parameter and then link the duration parameter to the same parameter in the subreport.

-LB
 
If you want to use the start/end date parameters, all you would need to do is to set the duration to a default value such as "Unused" or "Use Start/End Date", then use the record selection formula as groggle suggested with the following addition:

if {?Duration} = "Daily"
then {DateField} > currentdate-1
else if {?Duration} = "Weekly"
then {DateField} > currentdate-7
else if {?Duration} = "Monthly"
then {DateField} > DateAdd("m",-1,currentdate)
else {DateField} >= {?Start Date} and {DateField} <= {?End Date}

Then export the same parameters to the same subreport, where if you want the same records to be selected, just add in the same above formula to the record selection on the subreport.
 
Thanks everyone for your time and advice. I am going with changing the command to accept a duration parameter. Seems to work fine.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top