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!

Multiple Parameter Selection

Status
Not open for further replies.

edwindow

Programmer
Jul 13, 2001
51
US
I hope this is an easy one. I am making a custom parameter for my implementation team. I have one parameter that has 4 preset names such as 1_Name, 2_Name, 3_Name, and 4_Name. What I am doing is looking at the first position, which are the numbers and using them as identifiers for fields in the database. So in the code I look for the first positon of the string by doing something like this "1"=name[1]. So I look specifically at the first position. This way the implementer can name the default values based on the customers needs.
This idea works perfectly for single selections. However, when I have the multiple selection feature on, I can only get the first selection. Here is an example of the code:

stringVar MyText := "";

if "1" in {?Activity Description}[1] then
MyText:= MyText + {value.activity1} + " " ;
if "2" in {?Activity Description}[1] then
MyText:= MyText + {value.activity2} + " " ;
if "3" in {?Activity Description}[1] then
MyText:= MyText + {value.activity3} + " " ;
if "4" in {?Activity Description}[1] then
MyText:= MyText + {value.activity4} + " " ;

MyText;

As you can see I am taking the database values and grouping them as one string. Does anyone know how crystal groups multiple values? Are they comma seperated? I just want to be able to look at the first position for the selected values. If any one has any ideas please let me know. Thanks.

Eddie
 
Multiple value parameters are arrays. Refer to them as MyParm[1], MyParm[2], etc
 
I only have one parameter, but it has multiple values. I think I have to know the exact length of the multiple default value array. The parameter is Activity Description and currently it has 4 default values such as 1value, 2value,3value and 4value. I just want to to look for the nubers without knowing the length after the number.
 
WhilePrintingRecords;
NumberVar count:= count ({?MVParameter});

{?MVParameter} [1] +
if count > 1 then ", " + {?MVParameter} [2] +
if count > 2 then ", " + {?MVParameter} [3] +
if count > 3 then ", " + {?MVParameter} [4] .......

Continue this logic for as far as you would reasonably need to extend it to cover the maximum number of elements your multivalue parameter would have.

If you are using a number or date as your data type of your parameter, you will need to use the totext() function in conjunction with the above formula. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top