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

Using a multi-value parameter to select on a long (2000) text field 1

Status
Not open for further replies.

demosoc

Technical User
Jun 3, 2008
44
US
I'm wanting to select incoming data by comparing a multi value parameter to a text field(2000)which holds more info than that entered in the parameter.

An end user should be able to choose multiple codes (i.e. A, G, L, Z) as a parameter field (text) and the report should check each of those against the text field and display only the records which have one or more of these codes in the text field (the codes are separated by commas in the text field).
Record field
1 “C, F, N, O, P, Q, Z, AAA, AZA”
2 “B, D, E, F, R”
3 “A, B, C, J, K, R”
4 “B, C, S, T, U, V, W, X”
5 “A, G, M, V, Y”
6 “O, AK, LOBR”
7 “”
8 “H, T, Q”
9 “A, G, O”

In this case, I’d want the returned rows to be 1, 3, 5, and 9.
 
Is this a single multi-value parameter or a series on single value paramters?

Also please provide the crystal version.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Oops, sorry!
Crystal 9.2

This is one single multi-value parameter. Normally no problem {field} = {?parameter} but in this case, the field does not equal but actually contains the parameter info somewhere within a sea of other codes.
I'm thinking it has to do with arrays (which I've never used) and variables (which I've only used a wee bit)...

Thanks!
 
If this has a reasonably small number of possible values, you can write a formula like this:

if split({?YourParm}}[1] in {YourField} or
if split({?YourParm}}[2] in {YourField} or
if split({?YourParm}}[3] in {YourField} or
if split({?YourParm}}[4] in {YourField} or
if split({?YourParm}}[5] in {YourField}
then true else false

I am sure you can do this much more gracefully with a loop, but this is not something I know how to do.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Actually my formula was bad:


if instr({YourField},split({?YourParm}}[1])>0 or
if instr({YourField},split({?YourParm}}[2])>0 or
if instr({YourField},split({?YourParm}}[3])>0 or
if instr({YourField},split({?YourParm}}[4])>0 or
if instr({YourField},split({?YourParm}}[5])>
then true else false



Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
I've tried your suggestion as follows-

if
instr({vw_client_acfe_mktg_customers.Interests},split({?Interests?}[1]))>0 or
instr({vw_client_acfe_mktg_customers.Interests},split({?Interests?}[2]))>0 or
instr({vw_client_acfe_mktg_customers.Interests},split({?Interests?}[3]))>0 or
instr({vw_client_acfe_mktg_customers.Interests},split({?Interests?}[4]))>0 or
instr({vw_client_acfe_mktg_customers.Interests},split({?Interests?}[5]))>0
then true else false

Unfortunately, I get this error message-
"This array must be subscripted. For example: Array.
 
Try:

whilereadingrecords;
numbervar i;
numbervar j := ubound({?Interests?});
stringvar x;
for i := 1 to j do(
if {?Interests?} in {vw_client_acfe_mktg_customers.Interests} then
x := x + {vw_client_acfe_mktg_customers.Interests}
);
{vw_client_acfe_mktg_customers.Interests} in x

-LB
 
thank you LB,
Unfortunately I get this error:

"A string can be at most 65534 characters long."

The text field is a field where they've moved a bunch of seperate records into one, so the combination possibilities are huge. Is that what is throwing the calculations and can it be addressed inside Crystal?
 
You could try:

whilereadingrecords;
numbervar i;
numbervar j := ubound({?Interests?});
stringvar x;
for i := 1 to j do(
if {?Interests?} in {vw_client_acfe_mktg_customers.Interests} and
not({vw_client_acfe_mktg_customers.Interests} in x) then (
redim preserve x[j];
x := {vw_client_acfe_mktg_customers.Interests}
));
{vw_client_acfe_mktg_customers.Interests} in x

-LB
 
Oops, "stringvar x;" should have been changed to "stringvar array x;".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top