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

Array Parameter in Record Select 2

Status
Not open for further replies.

Jen123

Technical User
Mar 9, 2001
64
0
0
GB
Is there anyway you can pass an array parameter into the record selection formula in Crystal R XI.

Basically I have a field in my database that stores values such CA, ME, UK ({a.CatPartMarketCode} below)

I need a parameter where a user can select multiple markets. If the db field stored just one market it would be ok but as it stores multiple values comma separated i'm struggling.

The below works when a user selects just one market but goes wrong when a user tries to select more than 1 market. When there are multiples I can't seem to get an 'or' in.

Can this be done (or something like it!!)?

NumberVar iIndex;
(
if UBound({?Market})= 1 then
instr({a.CatPartMarketCode},{?Market}[1]) > 0
else if UBound({?Market})> 0 then
for iIndex:=1 to UBound({?Market}) do
if iIndex>1 then
instr({a.CatPartMarketCode},{?Market}[iIndex]) > 0
)
 
I used your formula for each parameters :
Ex: {@ArrAge_Array}:

numbervar i;
numbervar j := ubound({?Age});
stringvar x;

for i := 1 to j do(
if instr(x,{a.arrAge}) = 0 and
{?Age} = split({a.arrAge},", ") then
x := x + {a.arrAge}+", "
);
{a.arrAge} in x



Thanks you so much
 
I think I need to see all formulas.

-LB
 

{@ArrEthnicity_Array} and
{@ArrAge_Array}and
{@ArrRace_Array}



I used your formula for each parameters :
Ex: {@ArrAge_Array}:

numbervar i;
numbervar j := ubound({?Age});
stringvar x;

for i := 1 to j do(
if instr(x,{a.arrAge}) = 0 and
{?Age} = split({a.arrAge},",") then
x := x + {a.arrAge}+", "
);
{a.arrAge} in x

Ex:{@ArrEthnicity_Array}
numbervar i;
numbervar j := ubound({?Ethnicity});
stringvar x;
for i := 1 to j do(
if instr(x,{a.arrEthnicity}) = 0 and
{?Ethnicity} = split({a.arrEthnicity},",") then
x := x + {a.arrEthnicity}+", "
);
{a.arrEthnicity} in x


Ex:{@ArrRace_Array}
numbervar i;
numbervar j := ubound({?Race});
stringvar x;
for i := 1 to j do(
if instr(x,{a.arrRace}) = 0 and
{?Race} = split({a.arrRace},",") then
x := x + {a.arrRace}+", "
);
{a.arrRace} in x


record selection formula:-

{a.state} = {?State} and
{a.program} = {?Program} and
{@ArrEthnicity_Array} and
{@ArrAge_Array}and
{@ArrRace_Array}

{?State} and{?Program} (just bound to field not array field)



 
You need to change the variable names in each formula. Use a different letter for i, j, and x.

-LB
 
I did that but still show sometime right data and sometime not

EX:

If I pick up Non-Hispanic it will display
Non-Hispanic and also Hispanic one
 
lBass,

Thank you very much. It is working. It was data problem.

You are Star!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top