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

Array formulation in record selection 1

Status
Not open for further replies.

UHsoccer

Programmer
Apr 24, 2003
139
US
I need to select based on multiple entries

Something like the following (but that does not work)

for i = 1 to count({?Entered})
lcase ({?Entered} (i) ) IN lcase ({Field-Name})
next

Error : variable name expected at "i" in the " for i = ----" statement

By the way the " ({?Entered} (i) " really has square brackets, but they disappear in this posted message
 
If you want to limit rows returned based on a parameter that allows multiple values, use Report->Edit Selection Formula->Record and place something like:

{table.field} = {?Myparameter}

You don't need a loop.

To then display the choices made on the report, use:

"You selected :"+join({?Myparameter},", ")

-k
 
That is true, but when using the " like " expression it wants a subscripted array
 
Just to make sure you did everything ok, you need to declare 'i' and you should be using ':=' instead of '=' so it should be something like this:

numberVar i;
for i := 1 to 10 do ...;

Just checking the sytax is ok.

Rats
 
UHsoccer: The following will look for everything that was entered in the multi choice parameter:

{table.field} like {?Myparameter}

or you can use:

{table.field} like {?Myparameter}

Crystal treats them the same.

However if what you mean is that you want to be able to pass a Like predicate in the where clause of the SQL Expression so that you can select anything akin to those things entered/selected in the parameter, then you will also have to include wildcards, which your code doesn't appear to be handling.

Selecting on multiple entries is not the same as building a where clause to allow for the Like predicate, and you first post made no reference to that.

If you need true wildcard handling, let me know, I have code for that too.

-k
 
Ooops:

UHsoccer: The following will look for everything that was entered in the multi choice parameter:

{table.field} like {?Myparameter}

or you can use:

{table.field} = {?Myparameter}

-k
 
I don't think:

{table.field} = {?Myparameter}

will accept wild card entries in the parameter field, but LIKE will.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top