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) )That makes PageNo check effectively related to last 'Itemized Calls'.
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)However, you are doing a bigger mistake which not only newbies but experts do as well and that is, you are not prefixing your memory variables with mdot (you are doing that correctly for m.lnPageCount but that is more important when you are using one letter variables in the range A-J). Correct your code:
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=(m.I+1)Next, you could simplify your code a bit. You don't need to count how long is your string to compare. If set exact is off (VFP default), = acts as starts with:
LEFT(STREXTRACT(POS,'(',')'),10)= '- One Time' STREXTRACT(POS,'(',')')= '- One Time'Would both mean the same thing.
Scan For Between(PageNo, 2, m.lnpagecount) And ; ( Strextract(POS,'(',')')= '- One Time' Or ; STREXTRACT(POS,'(',')')='- Account Level Charges' Or ; STREXTRACT(POS,'(',')')='Itemized Calls' ) **Do Something based on certain conditions Endscan>I am using the following command to Locate something in a Table
>For I=2 to m.lnpagecount >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) > >IF Found() >**Do Something based on certain conditions >Endif > >I=I+1 >Endfor >>