Numeric Sorting Problem

Karen Karen at curlypaws.com
Sat Mar 12 18:44:56 EST 2005


Hi,

I've now managed to fix this by creating a hidden list with comma delimiters
and sorting on that.  But it leads to another puzzle.

I'm trying to get a dropdown menu to work in what will be a preference page.
In the openCard script for the stack I do the following:

  put empty into tMenuBar
  put "United Kingdom (GBP)" & CR into tMenuBar
  put "United States (USD)" after tMenuBar
  
  get button "Option Menu"
  put tMenuBar into button "Option Menu"
  
  set the menuHistory of button "Option Menu" to 1

The idea being that the option menu will then be populated, and item 1 will
be selected.  But when the substack appears, although the option menu is
populated no item is selected.  And when I select an item, the option menu
remains blank afterwards.  If anyone could offer any pointers on what I'm
doing wrong here it would be great.

I'm afraid I don't really understand Revolution's method for handling
dropdown lists as yet!

Thanks,

Karen


On 12/3/05 5:05 pm, "Karen" <Karen at curlypaws.com> wrote:

> 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