Sort question

Jim Ault jimaultwins at yahoo.com
Sun Oct 3 10:31:54 EDT 2010


Use the technique of sorting by a function call for each line to set a  
value.

on testSort
    put the clipboarddata into theListOfFriends
    sort theListOfFriends numeric ascending by sortByThisValue(each)

    ;put theListOfFriends
end testSort

function sortByThisValue singleLineOfList
      set the itemdel to "/"
      get word 2 of item 1 of singleLineOfList & "/" & item 2 of  
singleLineOfList & "/" & "01"
    --English system -- remove the next line
      get  item 2 of singleLineOfList  & "/" & word 2 of item 1 of  
singleLineOfList & "/" & "01"
      convert IT to seconds
       return IT
end sortByThisValue

This should do the task you want


On Oct 3, 2010, at 6:57 AM, Yves COPPE wrote:

> Hi list
>
> I have a list of lines
> each line has a first name & tab & a date (French format : DD/MM/YYYY)
>
> I want to sort the list on the DD/MM date without taking the YYYY  
> into account
>
> Here a sample :
>
> Jean	13/01/2017
> Luc	03/07/2017
> Bern	02/09/2015
> Michel	06/01/2018
> Bert	01/06/2016
> Jo	13/02/2016
> Rob	26/03/2018
> Nick	15/01/2015
>
> gives
>
> Michel	06/01/2018
> Jean	13/01/2017
> Nick	15/01/2015
> Jo	13/02/2016
> Rob	26/03/2018
> Bert	01/06/2016
> Luc	03/07/2017
> Bern	02/09/2015
>
> Can someone help me to to that ?
>

Jim Ault
Las Vegas






More information about the use-livecode mailing list