Numeric Sorting Problem
Karen at curlypaws.com
Sat Mar 12 11:05:15 CST 2005
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...
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
> The default is comma... And it's reset after any handler's execution...
> set it to tab before the sort to see...
>> -----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
>> 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
>> 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).
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
More information about the use-livecode