Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ALLTRIM in indexes
Message
From
27/09/1998 09:00:31
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00138923
Message ID:
00141208
Views:
32
>>>You are wasting cpu cycels because VFP pads the field back out to be a constant length when you use ALLTRIM(). SET EXACT OFF and "Name " = "Name" will be equal.
>>
>>Interesting! I assume the "constant length" is the original length of the field? What about in an expression like AllTrim(first) + AllTrim(second)?
>
>It will attempt to pad it to a fixed length, but that length may not be the whole concatenated string length. Essentially using ALLTRIM() (without surrounding it with a PADR or PADL) in an index expression is a prescription for a bug later on that will be really difficult to track down.

We may put this as a rule. I've found a workaround to achieve the listing by AllTrim(first)+' '+AllTrim(second):

index on first - (' '+second) tag whatever

The minus operator removes the trailing blanks from the First field and moves them to the end of the result. The extra blank before the Second serves the purpose of separating the two. Fox will internally trim the value in the .cdx, anyway, that's why it's called "compact" indexing.

Anyway, I've never used any trimming function in an index expression.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform