Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.paradox    |    To crash or not to crash, asks Borland    |    9,834 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,398 of 9,834    |
|    Jim Hargan to Kenneth    |
|    Re: My scan isn't scannin'...?    |
|    13 Aug 08 13:12:21    |
   
   From: contact@harganonline.com   
      
   In this line:   
    if (tc2.locate ("num", ident, "desc", "W") ...   
   the locate() moves your tCursor within the scan. The next time the scan   
   loops, it will take over from this new position. And this new position is   
   always the same position, as locate() always sends the tCursor to the first   
   matching record. So your scan gets stuck on one record.   
      
   Never move either the scanning tCursor or any records within a scan loop.   
      
   The scan should be sending tc2 straight to the correct records, as with:   
    scan tc2 for tc2."num" = ident and tc2."desc" = "W":   
    ;do something   
    endscan   
   or else testing withing the scan, as with:   
    scan tc2:   
    if tc2."num" = ident and tc2."desc" = "W"   
    then ;do something   
    else loop   
    endif   
    endscan   
      
   --   
   Jim Hargan   
      
   On Wed, 13 Aug 2008 12:20:00 -0400, Kenneth wrote:   
      
   > Howdy,   
   >   
   > I am trying to write some code that is to compare records in   
   > two tables. If it finds a particular record in one table but   
   > does not find a slightly different record in the other   
   > table, it is to do some stuff.   
   >   
   > The tCursors open fine, but when I try to scan tCursor 2 it   
   > seems not to increment.   
   >   
   > I put in some view statements to try to sort things out, but   
   > as I step through the code the same record number and phone   
   > number keep displaying.   
   >   
   > As I step through, I never get to DO STUFF. Instead, I am   
   > returned to the line " ident = tc2."num" " without ident   
   > having incremented.   
   >   
   > The code could not be much simpler, but I can't spot the   
   > problem:   
   >   
   >   
   > scan tc2:   
   > ident = tc2."num"   
   > ident.view()    
   > phone = tc2."info"   
   > phone.view()   
   >   
   > if (tc2.locate ("num", ident, "desc", "W") and   
   > not (tc1.locate ("num", ident, "desc", "W1")))   
   > then   
   >   
   > ;// DO STUFF   
   >   
   > else   
   > endIf   
   > endScan   
   >   
   >   
   > Many thanks for any help, as always,   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca