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

Display information corresponding to parameter 3

Status
Not open for further replies.

kutoose

Technical User
Sep 11, 2002
169
US
I have a parameter which is populated in the front end. The front end has 4 check boxes and the user has to select at least one check box to run the report.

The way the value is passed to the parameter is 1,2,3,4 if
all the check boxes are selected. If the second and third are selected the value passed is 2,3 like that...

Based on the values selected by the user I need to display information on the page header. The information is string value which is delimited by commas.String corresponding to 1,2,3,4 are "ABC","DEF","GHI","KLM"

If the user selects 1,2,3 then the string should be "ABC","DEF","GHI" if all values are selected then it should be "ABC","DEF","GHI","KLM", if only 2 is selected
then "DEF" like that.

How can I write a formula to accomplish this ?

kutoose@yahoo.com
 
Try:

whileprintingrecords;
stringvar ParmValues := {?MyParm};
stringvar array ArrayValues := split(Parmvalues,",");
stringvar Output:="";
numbervar x;
for x := 1 to ubound(ArrayValues) do(
if ArrayValues[x] = "1" then
Output:=Output+"ABC, "
else
if ArrayValues[x] = "2" then
Output:=Output+"DEF, "
else
if ArrayValues[x] = "3" then
Output:=Output+"GHI, "
else
if ArrayValues[x] = "4" then
Output:=Output+"JKL, "
);
left(Output,len(Output)-2)

Of course this is dependent upon your version of Crystal, something you should always include when posting about any software.

-k
 
Here's another option...
[tt]
whileprintingrecords;
stringvar array Strings := ["ABC","DEF","GHI","JKL"];
stringvar array Param := Split({?Parameter},",");
numbervar i;
stringVar array Output;

for i := 1 to Count(Param) do(
Redim Preserve Output;
Output := Strings[Val(Param)]
);

join(output,", ");
[/tt]
-dave
 
Thanks !
The Crystal Version is 10.

I will try what you have said and let you know !



kutoose@yahoo.com
 
Much slicker, *Dave*, considered something like that but I was too lazy to work it out ;)

-k
 
Thanks synapsevampire and vidru,
My problem solved !


kutoose@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top