Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locate + locate
Message
From
15/10/2007 02:27:43
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01260940
Message ID:
01260953
Views:
12
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform