Numeric sorting problem

MisterX b.xavier at internet.lu
Sat Mar 12 09:05:31 EST 2005


Hi Karen

You didn't mention it, but are you using the itemdelimiter tab or the
default?? 
The default is comma... And it's reset after any handler's execution...

set it to tab before the sort to see...

cheers
Xavier
--
http://monsieux.com/runrev.php



> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com 
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Karen
> Sent: Saturday, March 12, 2005 13:30
> To: use-revolution at lists.runrev.com
> Subject: Numeric sorting problem
> 
> Hi,
> 
> I'm trying to sort a container which is a scrolling list 
> field, populated with HTML text items separated by tabs.  The 
> typical format would be:
> 
> (Name)      (Ticker)    (Price)    (No.)    (Value)
> Share 1     BARC.L      484.00      100     484.00
> Share 2     RSA.L        85.79     1000     850.79
> 
> Column 1 is the alphabetic name of the stock, and I can sort 
> the list quite happily by setting the item delimiter to tab and doing:
> 
> sort lines of field "List Stocks" ascending text by item 1 of each
> 
> However, if I try to sort using the fifth column (the value 
> of the stock
> holding) by using the command:
> 
> sort lines of field "List Stocks" descending numeric by item 5 of each
> 
> Then nothing happens, the sort order remains unchanged.  I've 
> been trying various hacks, but all with no result - I can't 
> get it to sort on the numeric fields.
> 
> I'm a bit stumped as to why this isn't working, but it may be 
> impacted by the fact that the numeric fields are formatted 
> using a statement such as:
> 
> 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?
> 
> Am I doing something really silly here?  Any help would be 
> very gratefully received!
> 
> As an aside, is there a better way of sorting these items 
> using Revolution?
> What I currently do is read from my file and populate the 
> field.  Then, when a sort is requested, I sort the field and 
> then use the sorted lines from it to write out to my file 
> again (to ensure that the file and the display order remain in step).
> 
> Thanks,
> 
> Karen
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 



More information about the use-livecode mailing list