Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01260808
Message ID:
01260813
Vues:
12
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform