Sorting lines

Martin Baxter mb.userev at harbourhosting.co.uk
Tue May 29 14:26:54 EDT 2007


Jan Schenkel wrote:
> --- Martin Baxter <mb.userev at harbourhosting.co.uk>
> wrote:
>>> Hi Matthias,
>>>
>>> Try the following:
>>> ##
>>> set the itemDelimiter to ";"
>>> sort lines of tVariable by item 4 of each
>>> ##
>>>
>>> Hope this helped,
>>>
>>> Jan Schenkel.
>> Erm, this doesn't seem to work here in 2.8.1 on win
>> XP. The 
>> itemdelimiter appears to be ignored.
>>
>> Martin Baxter
>>
> 
> Hi Martin,
> 
> As the itemDelimiter is a local propert and thus gets
> reset at the end of a running handler, you have to run
> both lines together from a script, or in the
> multi-line section of the message box.
> 
> I tested it on MacOSX in Rev 2.6.1 and 2.8.1, and it
> worked in both:
> - I pasted the example text into a field:
> ##
> 320;4999;219;Peter;329;366
> 3;23;14;Mark;0;0
> 2;213;13;Josh;215;666
> 1000;999;10101;Mark;211;555
> 2;214;25;Peter;212:667
> ##
> - And added a button with the following script:
> ##
> on mouseUp
>   put field 1 into tVariable
>   sort lines of tVariable by random(10000)
>   set the itemDelimiter to ";"
>   sort lines of tVariable by item 4 of each
>   put tVariable into field 1
> end mouseUp
> ##
> 
> When clicking a few times, you may end up with
> different results, but the 'Josh', 'Mark' and 'Peter'
> lines are still lumped together.
> 
> Hope this helped,
> 
> Jan Schenkel.
> 

Hi Jan,

That's essentially what I did, but I tested it using Matthias' data from 
his email, which I hadn't noticed has a typo in line 1 - a comma instead 
of a semicolon.

# compounded operator errors ;-)

# mystery solved anyhow,

Martin Baxter



More information about the use-livecode mailing list