Numeric Sorting Problem

Karen Karen at curlypaws.com
Sat Mar 12 12:05:15 EST 2005


Thanks Xavier,

The bad news is that I do set the itemdelimiter to tab beforehand - so I
don't think that will be the problem.  But it does seem as if either the
delimiter isn't working, the format command is upsetting the numeric sort
attempt, or the HTMLText nature of the field is affecting the sort...

Karen

On 12/3/05 4:27 pm, "use-revolution-request at lists.runrev.com"
<use-revolution-request at lists.runrev.com> wrote:

> Message: 17
> Date: Sat, 12 Mar 2005 15:05:31 +0100
> From: "MisterX" <b.xavier at internet.lu>
> Subject: RE: Numeric sorting problem
> To: "'How to use Revolution'" <use-revolution at lists.runrev.com>
> Message-ID: <20050312140852.1F384930060 at mail.runrev.com>
> Content-Type: text/plain; charset="US-ASCII"
> 
> 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