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!

Displaying parameters chosen using a formula

Formula Help

Displaying parameters chosen using a formula

by  synapsevampire  Posted    (Edited  )
Displaying the parameter choices made for the user:

String parameters:

Discrete:

{?MyStringParameter}

Range value separated by ô to ö:

Minimum({?MyStringParameter})&" to "& Maximum({?MyStringParameter})

Multiple Discrete values separated by a comma:

join({?MyStringParameter},",")

Multiple Range values separated by a carriage return:

whileprintingrecords;
stringvar Output:="";
numbervar Counter;
For Counter := 1 to ubound({?MyStringParameter}) do(
Output:= Output&minimum({?MyStringParameter}[Counter])& " to "& maximum({?MyStringParameter}[Counter])&chr(13)
);
left(Output,len(Output)-1)

Multiple Range and Discrete values separated by a carriage return:

whileprintingrecords;
stringvar Output:="";
numbervar Counter;
For Counter := 1 to ubound({?MyStringParameter}) do(
if minimum({?MyStringParameter}[Counter])= maximum({?MyStringParameter}[Counter]) then
Output:= Output & minimum({?MyStringParameter}[Counter])&chr(13)
else
Output:= Output & minimum({?MyStringParameter}[Counter])& " to "& maximum({?MyStringParameter}[Counter])&chr(13)
);
left(Output,len(Output)-1)

Numeric parameters:

Discrete:

{?MyNumericParameter}

Range value separated by ôtoö:

Minimum({?MyNumericParameter})&" to "& Maximum({?MyNumericParameter})

For concerns with decimal precision and thousands separator, use:

totext(Minimum({?MyNumericParameter}),0,"")&" to "& totext(Maximum({?MyNumericParameter}),0,"")

Multiple Discrete values separated by a comma:

whileprintingrecords;
stringvar Output:="";
numbervar Counter;
For Counter := 1 to ubound({?MyNumericParameter}) do(
Output:= Output& totext({?MyNumericParameter}[Counter],0,"")& ","
);
left(Output,len(Output)-1)

Multiple Range values separated by a carriage return:

whileprintingrecords;
stringvar Output:="";
numbervar Counter;
For Counter := 1 to ubound({?MyNumericParameter}) do(
Output:= Output& totext(minimum({?MyNumericParameter}[Counter]),0,"")& " to "& totext(maximum({?MyNumericParameter}[Counter]),0,"")&chr(13)
);
left(Output,len(Output)-1)

Multiple Range and Discrete values separated by a carriage return:

whileprintingrecords;
stringvar Output:="";
numbervar Counter;
For Counter := 1 to ubound({?MyNumericParameter}) do(
if minimum({?MyNumericParameter}[Counter])= maximum({?MyNumericParameter}[Counter]) then
Output:= Output & totext(minimum({?MyNumericParameter}[Counter]),0,"")&chr(13)
else
Output:= Output & totext(minimum({?MyNumericParameter}[Counter]),0,"")& " to "& totext(maximum({?MyNumericParameter}[Counter]),0,"")&chr(13)
);
left(Output,len(Output)-1)

Date parameters:

Discrete:

{?MyDateParameter}

Range value separated by ôtoö:

Minimum({?MyDateParameter})&","& Maximum({?MyDateParameter})

Multiple Discrete values separated by a comma:

whileprintingrecords;
stringvar Output:="";
numbervar Counter;
For Counter := 1 to ubound({?MyDateParameter}) do(
Output:= Output& {?MyDateParameter}[Counter]& ","
);
left(Output,len(Output)-1)

Multiple Range values separated by a carriage return:

whileprintingrecords;
stringvar Output:="";
numbervar Counter;
For Counter := 1 to ubound({?MyDateParameter}) do(
Output:= Output& minimum({?MyDateParameter}[Counter])& " to "& maximum({?MyDateParameter}[Counter])&chr(13)
);
left(Output,len(Output)-1)

Multiple Range and Discrete values separated by a carriage return:

whileprintingrecords;
stringvar Output:="";
numbervar Counter;
For Counter := 1 to ubound({?MyDateParameter}) do(
if minimum({?MyDateParameter}[Counter])= maximum({?MyDateParameter}[Counter]) then
Output:= Output & minimum({?MyDateParameter}[Counter])&chr(13)
else
Output:= Output & minimum({?MyDateParameter}[Counter])& " to "& maximum({?MyDateParameter}[Counter])&chr(13)
);
left(Output,len(Output)-1)

As you can see from these examples, the differences between string and numeric (or dates and other data types) is that you must first convert non-string data types to a string, hopefully this will allow you to handle any data types.

-k
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top