Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Correct Syntax For 'AND' & 'OR' with Locate Command
Message
De
01/04/2018 03:56:45
 
 
À
25/03/2018 18:20:59
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., Nouvelle Zélande
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01658981
Message ID:
01659078
Vues:
54
Thank you, It is working correctly now.



>>>Since the value of I is 2 initially my cursor should Locate for page 3 initially and each time it should locate the data in Pageno 4 , 5 , 6 etc as the value of I increases by 1 each time.
>>>But Every Time cursor is halting on Pageno=2 even though the value if I is increasing to 3,4,5 etc. What is the problem ?
>
>As written, the AND only attaches to the "Itemized Calls" since AND takes priority. Use brackets around the ORs:
>
>
>LOCATE FOR ( LEFT(STREXTRACT(POS,'(',')'),10)= '- One Time' OR ;
>LEFT(STREXTRACT(POS,'(',')'),23)='- Account Level Charges' OR ; 
>LEFT(STREXTRACT(POS,'(',')'),23)='Itemized Calls' );
>AND Pageno=(I+1)
>
>While you're at it- also consider using INLIST around the second two STREXTRACT() rather than repeating the STREXTRACT().
>
>Finally, since this code effectively does a table scan for each I in your for...next unless you have indexes on all the expressions, then (depending on purpose) you might consider a SQL Select to determine which pageno meet your tests.
>
>
select pageno distinct from mytable where  LEFT(STREXTRACT(POS,'(',')'),10)= '- One Time' OR ;
>LEFT(STREXTRACT(POS,'(',')'),23) in ('- Account Level Charges','Itemized Calls') where pageno>2 order by pageno into cursor mycursor
Harsh
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform