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

Date Parameter

Status
Not open for further replies.

discskyer

Technical User
Nov 18, 2005
14
US
Hello,

I know how to display multiple records for string parameters using the join({?param}, ",") function, but how do you do this for dates? Thanks!
 
So you have a date parameter set up to allow multiple values? Create a formula like this:

whileprintingrecords;
stringvar x;
numbervar i;
numbervar j := ubound({?date});
for i := 1 to j do(
x := x + totext({?date},"MM/dd/yyyy")+", "
);
left(x,len(x)-2)

-LB
 
Thanks LB, will this also work for the range of dates option as well?
 
No. Please explain how you have your date parameter set up--are you allowing multiple range and discrete values? There is an faq that might help, also: faq767-5684.

-LB
 
Thank you again for your help LB.

What I'm trying to accomplish is to let the user decide on either a single date or range of dates. Through the setup of the parameter, the user has the option to enter either a discrete value or a range value. Granted, the user could add both, but I don't think they will ever do that.

What I would like to do is display this date (discrete or range) as part of the parameter display at the top of the report. Thanks again!
 
So you are allowing multiple values that can be range or discrete? Use:

whileprintingrecords;
stringvar x;
numbervar i;
numbervar j := ubound({?date});
for i := 1 to j do(
if minimum({?date}) = maximum({?date}) then
x := x + totext(minimum({?date}),"MM/dd/yyyy")+ ", " else
x := x + totext(minimum({?date}),"MM/dd/yyyy") + " to " + totext(maximum({?date}),"MM/dd/yyyy") + ", "
);
left(x,len(x)-2)

If you want to, you can replace the comma with chr(13), and change the last line to -1 instead of -2, and format the formula to "can grow." This would create a return after each parm value.

-LB
 
Thanks again LB!

Looks like I've got the report running properly now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top