Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index on IIF()
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01625898
Message ID:
01625905
Views:
45
>>Hi,
>>
>>I have a report cursor that has two columns (simplified), EMPL_ID, EMPL_NAME. Some records of the cursor have EMPL_NAME blank (even though EMPL_ID has value). But there is one record that has both the EMPL_ID and EMPL_NAME blank.
>>
>>And I want to index this cursor on EMPL_NAME but the record with both EMPL_ID and EMPL_NAME blank should be at the top. I tried the following (but it gives error):
>>
>>INDEX ON IIF(EMPTY(EMPL_ID,EMPL_ID,EMPL_NAME) TAG TAGNAME
>>
>>
>>I can update the value of the EMPL_NAME of the blank EMPL_ID with anything but so far I cannot find a value that will "put" this record at the top (because some other records could have blank EMPL_NAME too).
>>
>>Any suggestions?
>
>Ah, silly me... why do you need an index? Can you SELECT in the order you want? SELECT * FROM C_EMPLOYEES ORDER BY EMPL_NAME, EMPL_ID INTO CURSOR C_EMPLOYEES

No, you are not silly :). What I didn't say (just for the simplicity) is that I want to set the value "** No Employee ID **" in the column EMPL_NAME where EMPL_ID is blank. So your suggestion with the PADR() in the INDEX expression works though.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform