Re: how to split a list in two directions?

2017-10-28 Thread hh via use-livecode
> Alex T. wrote:
> Not a one-liner, but I'd be wiling to guess that
> 
> repeat for each line L in theData
>put item 2 of L into A1[item 1 of L]
>put item 1 of L into A2[item 2 of L]
> end repeat will
> 
> be as quick as any other method.

This is certainly a very fast and elegant method. The problem is,
that one of the items, here item 2 (a name), may not be unique.
So, in case "Müller" is among the names, this slight change may help:

repeat for each line L in theData
   put space & item 2 of L after A1[item 1 of L]
   put space & item 1 of L after A2[item 2 of L]
end repeat will


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: how to split a list in two directions?

2017-10-28 Thread Jim Lambert via use-livecode

> Tiemo wrote:
> 
> I have a delimiter separated list of two columns, first column is an ID,
> second column a name.
> 
> I need two arrays of this list, one with the first column (ID) as the key
> and one with the second column (name) as the key.
> 
> With split myArray by CR and ";"I get the first column (the ID) as the key.
> 
> Which is the most straight forward approach to get the second array with the
> name from the second column as the key? 
> 

Not a one-liner!

set the columnDelimiter to ";"
split myList by column -- your original delimiter separated list of two columns
put myList[2] into mySecondArray[1]
put myList[1] into mySecondArray[2]
combine mySecondArray by column
split mySecondArray by CR and “;”

Jim Lambert
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

AW: how to split a list in two directions?

2017-10-27 Thread Tiemo Hollmann TB via use-livecode
Yes thanks Alex
Tiemo


-Ursprüngliche Nachricht-
Von: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] Im Auftrag von 
Alex Tweedly via use-livecode
Gesendet: Freitag, 27. Oktober 2017 16:22
An: use-livecode@lists.runrev.com
Cc: Alex Tweedly 
Betreff: Re: how to split a list in two directions?

Not a one-liner, but I'd be wiling to guess that

   repeat for each line L in theData

   put item 2 of L into A1[item 1 of L]

   put item 1 of L into A2[item 2 of L]

   end repeat

will be as quick as any other method.

-- Alex.


On 27/10/2017 14:05, Tiemo Hollmann TB via use-livecode wrote:
> Hello,
>
> I have a delimiter separated list of two columns, first column is an 
> ID, second column a name.
>
> I need two arrays of this list, one with the first column (ID) as the 
> key and one with the second column (name) as the key.
>
> With split myArray by CR and ";" I get the first column (the ID) as the key.
>
> Which is the most straight forward approach to get the second array 
> with the name from the second column as the key? I am sure there is a 
> one liner, without first shifting the columns of the list in a repeat loop.
>
> Thanks
>
> Tiemo
>
>   
>
>   
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: how to split a list in two directions?

2017-10-27 Thread Alex Tweedly via use-livecode

Not a one-liner, but I'd be wiling to guess that

  repeat for each line L in theData

  put item 2 of L into A1[item 1 of L]

  put item 1 of L into A2[item 2 of L]

  end repeat

will be as quick as any other method.

-- Alex.


On 27/10/2017 14:05, Tiemo Hollmann TB via use-livecode wrote:

Hello,

I have a delimiter separated list of two columns, first column is an ID,
second column a name.

I need two arrays of this list, one with the first column (ID) as the key
and one with the second column (name) as the key.

With split myArray by CR and ";" I get the first column (the ID) as the key.

Which is the most straight forward approach to get the second array with the
name from the second column as the key? I am sure there is a one liner,
without first shifting the columns of the list in a repeat loop.

Thanks

Tiemo

  

  


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

how to split a list in two directions?

2017-10-27 Thread Tiemo Hollmann TB via use-livecode
Hello,

I have a delimiter separated list of two columns, first column is an ID,
second column a name.

I need two arrays of this list, one with the first column (ID) as the key
and one with the second column (name) as the key.

With split myArray by CR and ";" I get the first column (the ID) as the key.

Which is the most straight forward approach to get the second array with the
name from the second column as the key? I am sure there is a one liner,
without first shifting the columns of the list in a repeat loop.

Thanks

Tiemo

 

 

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode