INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Formula Help

Displaying parameters chosen using a formula by synapsevampire
Posted: 15 Feb 05

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

Back to Business Objects: Crystal Reports 1 Formulas FAQ Index
Back to Business Objects: Crystal Reports 1 Formulas Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close