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

setting a list of variables

Status
Not open for further replies.

marye

Technical User
Apr 22, 2003
8
0
0
US
Hello folks,

I'm trying to check multiple fields against a group of values. Instead of saying
IF (FIELD1 EQ 'BLAH1' OR 'BLAH2' OR 'BLAH3') OR
(FIELD2 EQ 'BLAH1' OR 'BLAH2' OR 'BLAH3') OR
(FIELD3...
I'd like to say
IF (FIELD1 EQ 'ck list of values in the variable') OR
(FIELD2 EQ 'ck list of values in the variable') OR
(FIELD3 EQ 'ck list of values in the variable'...

In my attempt to do this, I have something like
-SET &GRP = 'BLAH1,BLAH2,BLAH3';
and in the DEFINE
IF (FIELD1 EQ '&GRP.EVAL' OR
FIELD2 EQ '&GRP.EVAL' OR
FIELD3 EQ '&GRP.EVAL')...

There's obviously something I don't quite understand about what I supposed to do with this. I'm getting an error msg:
(FOC016) THE TRUNCATED FIELDNAME IS NOT UNIQUE: O
However, there is no 'O' value in my list at all.

Am at all on the right track or do I need to do something entirely different? Can somebody please clue me?

Thanks--Mary E.


 
Mary,

This is a 2 part question. The first, is how to put the values into a variable, for reuse. I'm assuming you used the correct syntax, as separating the values with commas instead of 'OR' doesn't work, and alpha fields must be enclosed in single quotes, like this:

Code:
-SET &COULST = '''ENGLAND'' OR ''FRANCE'' OR ''ITALY''';  
 DEFINE FILE CAR                                           
 TEST/I1 = IF (COUNTRY EQ &COULST) THEN 1 ELSE 0;          
 END                                                       
 TABLE FILE CAR                                            
 PRINT COUNTRY TEST                                        
 END

Note the separating 'OR' between values, and the 2 adjacent single quotes within the quoted string, to denote an imbedded single quote.

Now, as to your error, the expanded line must fit into FOCSTACK, which, until recently, had a limit of 80 characters. So, your expanded lines may be exceeding 80 characters, and the record is being truncated at an 'OR', so only the 'O' is seen (just a guess). If you run the procedure with ECHO=ON, you can see what FOCUS sees, which may explain more.
 
Hm, that's interestng. I originally had the ORs, but my manual seems to indicate that I should use commas instead. Of course, the only manual I have is one for 7.0. Plus, if our school is still on the 80 char software, this feature won't work for me anyway.

Thanks for the response & I'll try this out!

Mary E.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top