>>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.
As you are probably aware, as long as he pads the index commands and expressions he can get Rushmore optimization.
So with existing indexes INDEX ON PADR(ALLTRIM(marca),10) TAG IXMARCA in both tables...
LOCATE FOR PADR(ALLTRIM(ap.marca),10) = PADR(alltrim(ap_control.marca),10) will be Optimized.