Dee
asked on
Locate getting "unrecognized command verb"
I am getting "unrecognized command verb at "or descriptn = ".
I have tried enclosing in parenthesis before the or and after. No good.
locate for ;
isdigit(substr(breed1,3,1) ) ;
or isdigit(substr(breed1,4,1) );
or isdigit(substr(breed1,5,1) ) or empty(breed1);
or descriptn = "XXX" or descrip2 = "XXX" or descrip3 = "XXX" or descrip4 = "XXX" ;
or descrip5 = "XXX" or descrip6 = "XXX" or descrip7 = "XXX" or descrip8 = "XXX"
This part works fine, until I add the rest of the condition:
locate for ;
isdigit(substr(breed1,3,1) ) ;
or isdigit(substr(breed1,4,1) );
or isdigit(substr(breed1,5,1) ) or empty(breed1)
I have tried enclosing in parenthesis before the or and after. No good.
locate for ;
isdigit(substr(breed1,3,1)
or isdigit(substr(breed1,4,1)
or isdigit(substr(breed1,5,1)
or descriptn = "XXX" or descrip2 = "XXX" or descrip3 = "XXX" or descrip4 = "XXX" ;
or descrip5 = "XXX" or descrip6 = "XXX" or descrip7 = "XXX" or descrip8 = "XXX"
This part works fine, until I add the rest of the condition:
locate for ;
isdigit(substr(breed1,3,1)
or isdigit(substr(breed1,4,1)
or isdigit(substr(breed1,5,1)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Don't worry. Everybody who wants to be employed IS employed today... and this also means you may educate yourself while being employed.
Sorry, I forgot to mention how VFP handles string comparisons...
column = "XXX" can produce different results than "XXX" = column and this also affects the INLIST function.
The result is affected by SET EXACT setting and also by the possible existing spaces in the column data. So you did the easiest thing possible which was to return to the descriptn = "XXX" or descrip2 = "XXX" or …
Just one more note and to make it more complex - SQL commands in VFP ignore SET EXACT but they are using SET ANSI instead...
LOCATE command can be repeated by CONTINUE:
SELECT someTableAlias
LOCATE FOR someCondition
DO WHILE FOUND()
do some stuff here
… … …
SELECT someTableAlias
CONTINUE
ENDDO
Of course, CONTINUE expects the record pointer did not change in the someTableAlias.
SELECT INTO a cursor is more modern approach.
Sorry, I forgot to mention how VFP handles string comparisons...
column = "XXX" can produce different results than "XXX" = column and this also affects the INLIST function.
The result is affected by SET EXACT setting and also by the possible existing spaces in the column data. So you did the easiest thing possible which was to return to the descriptn = "XXX" or descrip2 = "XXX" or …
Just one more note and to make it more complex - SQL commands in VFP ignore SET EXACT but they are using SET ANSI instead...
LOCATE command can be repeated by CONTINUE:
SELECT someTableAlias
LOCATE FOR someCondition
DO WHILE FOUND()
do some stuff here
… … …
SELECT someTableAlias
CONTINUE
ENDDO
Of course, CONTINUE expects the record pointer did not change in the someTableAlias.
SELECT INTO a cursor is more modern approach.
ASKER
Thanks again pcelba.
I appreciate you!
I appreciate you!
ASKER
What would I do without my smarty experts! 😘 .. I'd likely be unemployed!
Just cut me some slack in the idiot department. I am bumbling around in Foxpro and stuck with it in my new employer's environment .. and having to tweak and enhance someone else 's spaghetti code!
INLIST is cleaner. I'll take it.
If the locate returns records, I am updating a field and appending the records to another table.
INLIST doesn't seem to work with replace? Code below.
Also, is there a way to retrieve the results of the LOCATE rather that repeat the criteria for the append? Or maybe I should look at doing a select into a cursor and append the results, if any.
--------------------------
locate for ;
isdigit(substr(breed1,3,1)
or isdigit(substr(breed1,4,1)
or isdigit(substr(breed1,5,1)
or INLIST("XXX", descriptn, descrip2, descrip3, descrip4, descrip5, descrip6, descrip7, descrip8)
if found()
replace all verifyimg with "a" for isdigit(substr(breed1,3,1)
isdigit(substr(breed1,5,1)
replace all verifyimg with "x";
for descriptn = "XXX" or descrip2 = "XXX" or descrip3 = "XXX" or descrip4 = "XXX" ;
or descrip5 = "XXX" or descrip6 = "XXX" or descrip7 = "XXX" or descrip8 = "XXX"
**INLIST doesn't work on the replace: ?
**for INLIST("XXX", descriptn, descrip2, descrip3, descrip4, descrip5, descrip6, descrip7, descrip8)
select ckBreedScrub
APPEND FROM (lcWeekPullFile) for verifyimg = "x" or verifyimg = "a"
replace all defaultdir with lcDir for verifyimg = "x" or verifyimg = "a";
and empty(defaultdir)
endif