Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan problem
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01260808
Message ID:
01260813
Views:
11
This message has been marked as the solution to the initial question of the thread.
>Scan is scanning only one record of table ap
>I mean, it's not scanning all the table until the final
>I wonder which command lines will cause trouble to scan
>
>
>USE AP
> SCAN
>
>rAp = RECNO()
>
>USE ap_control
>
>COUNT for ALLTRIM (AP.CL) = ALLTRIM(AP_CONTROL.CL) .and. ALLTRIM (AP.AP) = ALLTRIM(AP_CONTROL.AP);
>.and. ALLTRIM(ap.marca) = alltrim(ap_control.marca) .and. ALLTRIM(ap.modelo) = ALLTRIM(ap_control.modelo) TO ap_find
>
>IF ap_find = 0
>
> = MESSAGEBOX ("Not_found")
>
>APPEND FROM ap FOR RECNO() = rAp
>
> ELSE
>
>
> = MESSAGEBOX ("Found")
>
>
> ENDIF
> endscan

Because you close the table. I wonder why you don't get an error message?
Why you open the table within the scan?
USE ap_control
SELECT 0
USE Ap
SCAN
   rAp = RECNO([Ap])
   SELECT ap_control
   COUNT for ALLTRIM(AP.CL)     = ALLTRIM(AP_CONTROL.CL)    .and.;
             ALLTRIM(AP.AP)     = ALLTRIM(AP_CONTROL.AP)    .and.;
             ALLTRIM(ap.marca)  = alltrim(ap_control.marca) .and.;
             ALLTRIM(ap.modelo) = ALLTRIM(ap_control.modelo);
   TO ap_find

   IF ap_find = 0
      =MESSAGEBOX ("Not_found")
      APPEND FROM ap FOR RECNO() = rAp
   ELSE
      =MESSAGEBOX ("Found")
   ENDIF
   SELECT Ap
endscan
But that whole thing could be done that way (If you use VFP9)
INSERT INTO Ap_Control;
SELECT Ap.*;
       FROM Ap;
LEFT JOIN Ap_Control ON ALLTRIM(AP.CL)     == ALLTRIM(AP_CONTROL.CL)    .and.;
                        ALLTRIM(AP.AP)     == ALLTRIM(AP_CONTROL.AP)    .and.;
                        ALLTRIM(ap.marca)  == alltrim(ap_control.marca) .and.;
                        ALLTRIM(ap.modelo) == ALLTRIM(ap_control.modelo);
WHERE Ap_Control.CL IS NULL
If it is possible remove all ALLTRIM() functions from that query. Make sure that you have proper indexes and that statement will be very fast.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform