Numeric sorting problem
mark at maseurope.net
Sat Mar 12 11:55:36 CST 2005
On 12 Mar 2005, at 16:27, Karen wrote:
> I'm a bit stumped as to why this isn't working, but it may be impacted
> the fact that the numeric fields are formatted using a statement such
> put format("%8.2f",tField) into tField
> Before being put into the lines, to ensure that they line up correctly.
> Could the leading spaces affect the sort?
Try sorting on words rather than items. One possible gotcha is that the
shares might have multi-word names, but since stock data usually has
the numbers at the end of the line you could use the negative word
numbers ie. sort lines of fld "List Stocks" numeric by word -1 of each.
Also, if your lists get quite long, you might get a speed improvement
by putting the field into a variable, sorting the variable and then
putting it back into the field. In general, direct operations on fields
tend to be much slower than operations on variables.
More information about the use-livecode