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 based on parameter input

Status
Not open for further replies.

jpstoehner

Technical User
Feb 7, 2007
8
0
0
US
I have a date range parameter in my report and need a formula that prints the accounting period corresponding to whatever dates are selected. For example, our "Period 1" runs 12/27/2006 to 1/23/2007. How would I create a field that I could insert on the report that reads "Period 1" if these are the dates entered in the parameter? "Period 2" is 1/24/2007 to 2/20/2007 so I'd want the field to say Period 2 if those are the dates entered in the parameter range, etc.

Thanks!
 
Something like:

if minimum({?MyDateParm}) in cdate(2006,12,27) to cdate(2007,1,23) then
"Period 1"
else
...other dates...

-k
 

It gives me an error saying my parameter field cannot be summarized. Here's the code...

if minimum({?PERIOD}) in cdate(2006,12,27) to cdate(2007,1,23) then "Period 1" else
if minimum({?PERIOD}) in cdate(2007,1,24) to cdate(2007,2,20) then "Period 2" else
if minimum({?PERIOD}) in cdate(2007,2,21) to cdate(2007,3,20) then "Period 3" else
if minimum({?PERIOD}) in cdate(2007,3,21) to cdate(2007,4,17) then "Period 4" else
if minimum({?PERIOD}) in cdate(2007,4,18) to cdate(2007,5,15) then "Period 5" else
if minimum({?PERIOD}) in cdate(2007,5,16) to cdate(2007,6,12) then "Period 6" else
if minimum({?PERIOD}) in cdate(2007,6,13) to cdate(2007,7,10) then "Period 7" else
if minimum({?PERIOD}) in cdate(2007,7,11) to cdate(2007,8,7) then "Period 8" else
if minimum({?PERIOD}) in cdate(2007,8,8) to cdate(2007,9,4) then "Period 9" else
if minimum({?PERIOD}) in cdate(2007,9,5) to cdate(2007,10,2) then "Period 10" else
if minimum({?PERIOD}) in cdate(2007,10,3) to cdate(2007,10,30) then "Period 11" else
if minimum({?PERIOD}) in cdate(2007,10,31) to cdate(2007,11,27) then "Period 12" else
if minimum({?PERIOD}) in cdate(2007,11,28) to cdate(2007,12,25) then "Period 13"

I tried changing my parameter to a date field, number, string, and still get the same error. What am I missing?
 

Sorry, please disregard. I had the parameter set up as a discrete value instead of range.


Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top