I recently run into the problem of not getting the right order for records on a temporary table. This is how data looked when using and index created as follows:
INDEX ON UPPER(company_name)+UPPER(dept_name)+UPPER(EMPLOYEE_LASTNAME)+UPPER(EMPLOYEE_FIRSTNAME) TAG ciadeptemp
COMPANY_NAME,DEPT_NAME,LAST_NAME,FIRST_NAME Company 1, null,j,cCompany 2, Sales,f,cCompany 1,Tech Support,g,c
What happened? Shouldn't I get all the 'Company 1' records before seeing 'Company 2'? Of course, but that is in case there were not null values in any of the fields that are part of the index key.
In my case, field "dept_name" accepted .null. values so the index key for that record evaluates to .NULL., therefore, appears at the top. This new index key solved it:
INDEX ON UPPER(company_name)+UPPER(IIF(ISNULL(dept_name),space(40),dept_name))+UPPER(EMPLOYEE_LASTNAME)+UPPER(EMPLOYEE_FIRSTNAME) TAG ciadeptemp
Never run into this before, so many years working with VFP but how much I've got to learn yet. Did anybody resolve this in a different way?
Remember Me
Page rendered at 3/11/2010 5:46:08 PM (Eastern Standard Time, UTC-05:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.