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

Displaying every iteration of multiple parameters in a single row

Status
Not open for further replies.

crogers111

Technical User
Jan 23, 2004
158
US
CRXI
SQL 2005

I have 6 paramaters that prompt users to enter Y/N to determine if the data is included in the record selection. I'm trying to develop the formula to place in the report footer thats shows which parameters were chosen.

HERE ARE EXAMPLES OF THE PARAMETERS

?Include A
?Include B
?Incluce C
?Include D
?Include E
?Include F

The parameters are STRING and users are instructed to enter Y or N. The record selection is working correctly to determine if the data is included in the report but I assume there's a better way to write a formula to show the choices in a single row other than an IF/THEN for every iteration.

If users enter the following for the above parameters: Y, Y, N, Y, N, Y

HERE IS THE DESIRED OUTPUT:

"The types selected are: A, B, D, F"

Thanks
 
formula
"Type selected are " + {?parm1} + ", " + {?parm2} + ", " + {?parm3} + ", " + {?parm4} + ", " + {?parm5} + ", " + {?parm6}

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
Thanks, but I believe that will give me: "Type selected are: Y, Y, N, Y, N, Y"
I'd like to display as I mentioned above and exclude those from the output where the user entered 'N'
 
OH I See.. Sorry about that I didn't read all the way through but since I answered the first time I feel obligated to come up with some kind of solution .. Here is one but someone may come up with something better


Code:
stringvar a := if {?parm1} = "Y" then "A, " else "";
stringvar b := if {?parm2} = "Y" then "B, " else "";
stringvar c := if {?parm3} = "Y" then "C, " else "";
stringvar d := if {?parm4} = "Y" then "D, " else "";
stringvar e := if {?parm5} = "Y" then "E, " else "";
stringvar f := if {?parm6} = "Y" then "F, " else "";
stringvar output := a +  b + c +d + e + f;

output := left(output,len(output)-2)

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
The Types Selected Are: "
&(if {?Include A} = 'Y' then 'A, ' else '')
&(if {?Include B} = 'Y' then 'B, ' else '')
. . .
then check to see if the last character is a comma and truncate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top