join columns

JB sundown at pacifier.com
Thu Aug 28 17:27:15 EDT 2014


Hi Phil,

I am having trouble with the proper way
to write the combine pData by column.

I can split the columns and reverse them
like you show but how do you write the
code to combine them?  It looks to me
from the dictionary the column needs
to be a number but what line do I need
to put them on?

John Balgenorth


On Aug 28, 2014, at 12:10 PM, Phil Davis <revdev at pdslabs.net> wrote:

> If pData is a CR-delimited list where each line contains tab-delimited items, why not use 'split by column'?
> 
> -- example: switch positions of columns 2 and 4
> 
>   split pData by column
>   put pData[4] into tTemp2
>   put pData[2] into pData[4]
>   put tTemp2 into pData[2]
> 
> 
> -- then put it back together as a list:
> 
>   combine pData by column
> 
> That should do it.
> 
> Phil Davis
> 
> 
> 
> On 8/28/14, 11:54 AM, JB wrote:
>> Richard Gaskin wrote a function to get a column
>> from a list.
>> 
>> function GetCol pData, pCol --Richard Gaskin
>>     set the itemdel to tab
>>     put empty into tReturnList
>>     repeat for each line tLine in pData
>>         put item pCol of tLine &cr after tReturnList
>>     end repeat
>>     delete last char of tReturnList -- trailing CR
>>     return tReturnList
>> end GetCol
>> 
>> Does anyone know how to convert this so you can
>> join the selected columns back together in any
>> order you want?
>> 
>> John Balgenorth
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> -- 
> Phil Davis
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list