NULL characters and sorting
support at ahsomme.com
Thu Mar 19 17:16:28 EDT 2009
One of my customers had a problem displaying all of their archived
There should have been 16,020 archived records but only 3,879 were
showing up in the list.
They could "Find" the missing records and navigate to them with the
"Next" and "Previous" commands.
Other programs in the system would show the entire list.
In approx. three years on the market, no other customers using the
same system had reported this problem with their data.
I started checking the contents of variables in the appropriate
handler and discovered there were the proper number of records just
before a sort by column. After the sort, records were missing.
Phil, the Great, Davis - Wizard of West Linn - suggested checking for
and removing NULLs (because they terminate a line in C). They were
131,023 NULLs in the pre-sort variable.
When I removed them before the sort, the number of listed records
jumped from 3,879 to 16,020.
This leaves some questions:
How can 131,023 NULL "characters" reduce the displayed "lines" by
Are there other characters that should be trapped before a sort?
This problem was verified on many computers running OS X - both Tiger
and Leopard, from G4 iMacs to the most recent 24" Intel iMac.
Here is the code that does the sorting:
sort lines of tDisplayRecords ascending by item tSortColumn of each
Sorting ascending or descending made no difference, the selected sort
column made no difference.
Your insight is appreciated.
More information about the Use-livecode