Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use logical field (.f.) in a compound index
Message
From
22/06/2007 14:19:23
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
22/06/2007 11:50:23
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01235052
Message ID:
01235077
Views:
22
>>Greetings all,
>>I am attempting to use a logical field name checkStub (.f., or .t.) in a compound index. The code requires the field to remain a logical fields: .f. or .t. I would like to sort in a compound index with a character field named vendCode. I tried:
>>
>> str(checkStub) + vendCode
>>
>>but that gives me "invalid type".
>>
>>Any ideas?
>>
>>thanks, vince
>
>To combine several fields, you must normally convert everything to character type.
>
>Here are two alternatives:
>
>
>* Option 1
>index on transform(CheckStub) + VendCode
>
>* Option 2 - smaller index
>index on iif(CheckStub, "1", "0") + VendCode
>* or
>index on iif(CheckStub, "T", "F") + VendCode
>
And a short version of option 1, ergo 1b:
index on TRANSFORM(CheckStub, "Y") + VendCode
The nice thing about all these is that the false values will come before true values. I wish we had that order in language, when naming code: post_hook comes before pre_hook; "before_*" comes after "after_*"... whichever word pair I tried, it sorts wrongly.

Hmmm... maybe ante- and post- would be good?

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