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,c
Company 2, Sales,f,c
Company 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?