Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locate + locate
Message
De
15/10/2007 02:27:43
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01260940
Message ID:
01260953
Vues:
13
>Is it possible to put an .OR. in the two commands locate
>below, using only one locate commad ?
>
>
>loca for AP.id = AP_CONTROL.id .and. ALLTRIM(AP.AP) = ALLTRIM(AP_CONTROL.AP) .and.;
> ALLTRIM(ap.marca) = alltrim(ap_control.marca) .and.;
> ALLTRIM(ap.modelo) = ALLTRIM(ap_control.modelo) .and. ap.serie = ap_control.serie
>
>
> **************OR******************
>
>
> loca for AP.id = AP_CONTROL.id .and. ALLTRIM(ap.marca) = alltrim(ap_control.marca).and. ap.serie = ap_control.serie

Ho Moises,

as I wrote yesterday, AVOID alltrim unless you really need it! I guess this change gives the same result AND is much faster:
loca for AP.id     = AP_CONTROL.id    .and.  AP.AP=AP_CONTROL.AP    .and.;
   ap.marca  = ap_control.marca .and.;
   ap.modelo = ap_control.modelo .and. ap.serie = ap_control.serie
If you get wrong results, it's becuase you have Set exact off. In that case you can use replace = with ==
loca for AP.id = AP_CONTROL.id    .and.  AP.AP==AP_CONTROL.AP .and.;
   ap.marca  == ap_control.marca .and.;
   ap.modelo == ap_control.modelo .and. ap.serie = ap_control.serie
With Set exact off, which most programmer has as default, you must be aware that trim('aaa')=trim('a') will return .T., which in your case probably is not what you expect. On the other hand 'aaa'=='a' will return .F..

BTW, if you are aware of this, and your command gives you the correct answer, please ignore tis message. But you should be aware that the use of alltrim in this case means that you lose Rushmore optimizing, meaning that your program will run much slower than it could have done.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform