join columns

classic Classic list List threaded Threaded
18 messages Options
JB
Reply | Threaded
Open this post in threaded view
|

join columns

JB
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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

Phil Davis-5
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
> [hidden email]
> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
JB
Reply | Threaded
Open this post in threaded view
|

Re: join columns

JB
Thanks a whole bunch, Phil !!!

John Balgenorth


On Aug 28, 2014, at 12:10 PM, Phil Davis <[hidden email]> 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
>> [hidden email]
>> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

Phil Davis-5
In reply to this post by Phil Davis-5
Before doing the 'split', you could set the columnDelimiter to whatever
char is used as the item delimiter. In other words, you aren't limited
to tabs as your column delimiter.

Phil


On 8/28/14, 12:10 PM, Phil Davis 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
>> [hidden email]
>> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

Alain Farmer
In reply to this post by JB
on insertAsColumn colNumber, dataToInsert, intoThisTable
    --
    if the number of lines of dataToInsert is not the number of lines of intoThisTable
    then die "Error: Lists have different lengths."
    --
    set the itemdel to tab
    repeat for each line x in dataToInsert
        get line x of dataToInsert
        put it & tab before item colNumber of line x of intoThisTable
    end repeat
    return intoThisTable
    --
insertAsColumn

on die dyingMessage
    answer dyingMessage
    exit to top
end die



On Thursday, August 28, 2014 2:59:04 PM, JB <[hidden email]> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

Alain Farmer
Correction:

function insertAsColumn colNumber, dataToInsert, intoThisTable
    --
    if the number of lines of dataToInsert is not the number of lines of intoThisTable
    then die "Error: Lists have different lengths."
    --
    set the itemdel to tab
    repeat for each line x in dataToInsert
        get line x of dataToInsert
        put it & tab before item colNumber of line x of intoThisTable
    end
 repeat
    return intoThisTable
    --
end insertAsColumn

on die dyingMessage
    answer dyingMessage
    exit to top
end die




On , Alain Farmer <[hidden email]> wrote:
 


on insertAsColumn colNumber, dataToInsert, intoThisTable
    --
    if the number of lines of dataToInsert is not the number of lines of intoThisTable
    then die "Error: Lists have different lengths."
    --
    set the itemdel to tab
    repeat for each line x in dataToInsert
        get line x of dataToInsert
        put it & tab before item colNumber of line x of intoThisTable
    end
 repeat
    return intoThisTable
    --
insertAsColumn

on die dyingMessage
    answer dyingMessage
    exit to top
end die



On Thursday, August 28, 2014 2:59:04 PM, JB <[hidden email]> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
JB
Reply | Threaded
Open this post in threaded view
|

Re: join columns

JB
In reply to this post by Phil Davis-5
That is what I thought but once again thank yu
for the info and the clarification.  It helps a lot!

John Balgenorth


On Aug 28, 2014, at 12:17 PM, Phil Davis <[hidden email]> wrote:

> Before doing the 'split', you could set the columnDelimiter to whatever char is used as the item delimiter. In other words, you aren't limited to tabs as your column delimiter.
>
> Phil
>
>
> On 8/28/14, 12:10 PM, Phil Davis 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
>>> [hidden email]
>>> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
JB
Reply | Threaded
Open this post in threaded view
|

Re: join columns

JB
In reply to this post by Alain Farmer
Thank you, Alain!  This example will
help me out.

John Balgenoth


On Aug 28, 2014, at 12:24 PM, Alain Farmer <[hidden email]> wrote:

> Correction:
>
> function insertAsColumn colNumber, dataToInsert, intoThisTable
>     --
>     if the number of lines of dataToInsert is not the number of lines of intoThisTable
>     then die "Error: Lists have different lengths."
>     --
>     set the itemdel to tab
>     repeat for each line x in dataToInsert
>         get line x of dataToInsert
>         put it & tab before item colNumber of line x of intoThisTable
>     end
> repeat
>     return intoThisTable
>     --
> end insertAsColumn
>
> on die dyingMessage
>     answer dyingMessage
>     exit to top
> end die
>
>
>
>
> On , Alain Farmer <[hidden email]> wrote:
>
>
>
> on insertAsColumn colNumber, dataToInsert, intoThisTable
>     --
>     if the number of lines of dataToInsert is not the number of lines of intoThisTable
>     then die "Error: Lists have different lengths."
>     --
>     set the itemdel to tab
>     repeat for each line x in dataToInsert
>         get line x of dataToInsert
>         put it & tab before item colNumber of line x of intoThisTable
>     end
> repeat
>     return intoThisTable
>     --
> insertAsColumn
>
> on die dyingMessage
>     answer dyingMessage
>     exit to top
> end die
>
>
>
> On Thursday, August 28, 2014 2:59:04 PM, JB <[hidden email]> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

Alain Farmer
Here is the paranoid version :

function insertAsColumn colNumber, dataToInsert, intoThisTable
    --
    if dataToInsert is empty then
        answer "insert empty column ?" with "cancel" or "insert"
        if it is "cancel" then exit to top
    end if
    --
    if intoThisTable is empty then return dataToInsert
    --
    if the number of lines of dataToInsert is not the number of lines of intoThisTable
    then die "Error: Lists have different lengths."
    --
    set the itemdel to tab
    put the number of items of line 1 of intoThisTable into lastCol
    if (colNumber < 1) or (colNumber > lastCol) then
        ask "colNumber must be an integer between 1 and" && lastCol with 1
        if the result is "cancel" then exit to top
        if (it is empty) or (it is not a number)
        then die "colNumber must be an integer between 1 and" && lastCol
    end if
    --
    repeat for each line x in dataToInsert
        get line x of dataToInsert
        put it & tab before item colNumber of line x of intoThisTable
    end repeat
    return intoThisTable
    --
end insertAsColumn

on die dyingMessage
    answer dyingMessage
    exit to top
end die



On Thursday, August 28, 2014 3:31:30 PM, JB <[hidden email]> wrote:
 


Thank you, Alain!  This example will
help me out.

John Balgenoth


On Aug 28, 2014, at 12:24 PM, Alain Farmer <[hidden email]> wrote:

> Correction:
>
> function insertAsColumn colNumber, dataToInsert, intoThisTable
>     --
>     if the number of lines of dataToInsert is not the number of lines of intoThisTable
>     then die "Error: Lists have different lengths."
>     --
>     set the itemdel to tab
>     repeat for each line x in dataToInsert
>         get line x of dataToInsert
>         put it & tab before item colNumber of line x of intoThisTable
>     end
> repeat
>     return intoThisTable
>     --
> end insertAsColumn
>
> on die dyingMessage
>     answer dyingMessage
>     exit to top
> end die
>
>
>
>
> On , Alain Farmer <[hidden email]> wrote:
>
>
>
> on insertAsColumn colNumber, dataToInsert, intoThisTable
>     --
>     if the number of lines of dataToInsert is not the number of lines of intoThisTable
>     then die "Error: Lists have different lengths."
>     --
>     set the itemdel to tab
>     repeat for each line x in dataToInsert
>         get line x of dataToInsert
>         put it & tab before item colNumber of line x of intoThisTable
>     end
> repeat
>     return intoThisTable
>     --
> insertAsColumn
>
> on die dyingMessage
>     answer dyingMessage
>     exit to top
> end die
>
>
>
> On Thursday, August 28, 2014 2:59:04 PM, JB <[hidden email]> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

skiplondon
Haha. I like the paranoid version :)

SKIP


On Thu, Aug 28, 2014 at 3:53 PM, Alain Farmer <[hidden email]>
wrote:

> Here is the paranoid version :
>
> function insertAsColumn colNumber, dataToInsert, intoThisTable
>     --
>     if dataToInsert is empty then
>         answer "insert empty column ?" with "cancel" or "insert"
>         if it is "cancel" then exit to top
>     end if
>     --
>     if intoThisTable is empty then return dataToInsert
>     --
>     if the number of lines of dataToInsert is not the number of lines of
> intoThisTable
>     then die "Error: Lists have different lengths."
>     --
>     set the itemdel to tab
>     put the number of items of line 1 of intoThisTable into lastCol
>     if (colNumber < 1) or (colNumber > lastCol) then
>         ask "colNumber must be an integer between 1 and" && lastCol with 1
>         if the result is "cancel" then exit to top
>         if (it is empty) or (it is not a number)
>         then die "colNumber must be an integer between 1 and" && lastCol
>     end if
>     --
>     repeat for each line x in dataToInsert
>         get line x of dataToInsert
>         put it & tab before item colNumber of line x of intoThisTable
>     end repeat
>     return intoThisTable
>     --
> end insertAsColumn
>
> on die dyingMessage
>     answer dyingMessage
>     exit to top
> end die
>
>
>
> On Thursday, August 28, 2014 3:31:30 PM, JB <[hidden email]> wrote:
>
>
>
> Thank you, Alain!  This example will
> help me out.
>
> John Balgenoth
>
>
> On Aug 28, 2014, at 12:24 PM, Alain Farmer <[hidden email]> wrote:
>
> > Correction:
> >
> > function insertAsColumn colNumber, dataToInsert, intoThisTable
> >     --
> >     if the number of lines of dataToInsert is not the number of lines of
> intoThisTable
> >     then die "Error: Lists have different lengths."
> >     --
> >     set the itemdel to tab
> >     repeat for each line x in dataToInsert
> >         get line x of dataToInsert
> >         put it & tab before item colNumber of line x of intoThisTable
> >     end
> > repeat
> >     return intoThisTable
> >     --
> > end insertAsColumn
> >
> > on die dyingMessage
> >     answer dyingMessage
> >     exit to top
> > end die
> >
> >
> >
> >
> > On , Alain Farmer <[hidden email]> wrote:
> >
> >
> >
> > on insertAsColumn colNumber, dataToInsert, intoThisTable
> >     --
> >     if the number of lines of dataToInsert is not the number of lines of
> intoThisTable
> >     then die "Error: Lists have different lengths."
> >     --
> >     set the itemdel to tab
> >     repeat for each line x in dataToInsert
> >         get line x of dataToInsert
> >         put it & tab before item colNumber of line x of intoThisTable
> >     end
> > repeat
> >     return intoThisTable
> >     --
> > insertAsColumn
> >
> > on die dyingMessage
> >     answer dyingMessage
> >     exit to top
> > end die
> >
> >
> >
> > On Thursday, August 28, 2014 2:59:04 PM, JB <[hidden email]>
> 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
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> >
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

Alain Farmer
Improved it again :

function insertAsColumn colNumber, dataToInsert, intoThisTable
    --
    if dataToInsert is empty then
        answer "insert empty column ?" with "cancel" or "insert"
        if it is "cancel" then exit to top
    end if
    --
    if intoThisTable is empty then return dataToInsert
    --
    if the number of lines of dataToInsert is not the number of lines of intoThisTable
    then die "Error: Lists have different lengths."
    --
    set the itemdel to tab
    put the number of items of line 1 of intoThisTable into lastCol
    if (colNumber < 1) or (colNumber > lastCol) then
        ask "colNumber must be an integer between 1 and" && lastCol with 1
        if the result is "cancel" then exit to top
        if (it is empty) or (it is not a number)
        then die "colNumber must be an integer between 1 and" && lastCol
    end if
    --
    if colNumber is lastCol then
        repeat for each line x in dataToInsert
            get line x of dataToInsert
            put tab & it after line x of intoThisTable
        end repeat
    else
        repeat for each line x in dataToInsert
            get line x of dataToInsert
            put it & tab before item colNumber of line x of intoThisTable
        end repeat
    end if
    --
    return intoThisTable
    --
end insertAsColumn

on die dyingMessage
    answer dyingMessage
    exit to top
end die



On Thursday, August 28, 2014 4:04:10 PM, Magicgate Software - Skip Kimpel <[hidden email]> wrote:
 


Haha. I like the paranoid version :)

SKIP


On Thu, Aug 28, 2014 at 3:53 PM, Alain Farmer <[hidden email]>
wrote:

> Here is the paranoid version :
>
> function insertAsColumn colNumber, dataToInsert, intoThisTable
>     --
>     if dataToInsert is empty then
>         answer "insert empty column ?" with "cancel" or "insert"
>         if it is "cancel" then exit to top
>     end if
>     --
>     if intoThisTable is empty then return dataToInsert
>     --
>     if the number of lines of dataToInsert is not the number of lines of
> intoThisTable
>     then die "Error: Lists have different lengths."
>     --
>     set the itemdel to tab
>     put the number of items of line 1 of intoThisTable into lastCol
>     if (colNumber < 1) or (colNumber > lastCol) then
>         ask "colNumber must be an integer between 1 and" && lastCol with 1
>         if the result is "cancel" then exit to top
>         if (it is empty) or (it is not a number)
>         then die "colNumber must be an integer between 1 and" && lastCol
>     end if
>     --
>     repeat for each line x in dataToInsert
>         get line x of dataToInsert
>         put it & tab before item colNumber of line x of intoThisTable
>     end repeat
>     return intoThisTable
>     --
> end insertAsColumn
>
> on die dyingMessage
>     answer dyingMessage
>     exit to top
> end die
>
>
>
> On Thursday, August 28, 2014 3:31:30 PM, JB <[hidden email]> wrote:
>
>
>
> Thank you, Alain!  This example will
> help me out.
>
> John Balgenoth
>
>
> On Aug 28, 2014, at 12:24 PM, Alain Farmer <[hidden email]> wrote:
>
> > Correction:
> >
> > function insertAsColumn colNumber, dataToInsert, intoThisTable
> >     --
> >     if the number of lines of dataToInsert is not the number of lines of
> intoThisTable
> >     then die "Error: Lists have different lengths."
> >     --
> >     set the itemdel to tab
> >     repeat for each line x in dataToInsert
> >         get line x of dataToInsert
> >         put it & tab before item colNumber of line x of intoThisTable
> >     end
> > repeat
> >     return intoThisTable
> >     --
> > end insertAsColumn
> >
> > on die dyingMessage
> >     answer dyingMessage
> >     exit to top
> > end die
> >
> >
> >
> >
> > On , Alain Farmer <[hidden email]> wrote:
> >
> >
> >
> > on insertAsColumn colNumber, dataToInsert, intoThisTable
> >     --
> >     if the number of lines of dataToInsert is not the number of lines of
> intoThisTable
> >     then die "Error: Lists have different lengths."
> >     --
> >     set the itemdel to tab
> >     repeat for each line x in dataToInsert
> >         get line x of dataToInsert
> >         put it & tab before item colNumber of line x of intoThisTable
> >     end
> > repeat
> >     return intoThisTable
> >     --
> > insertAsColumn
> >
> > on die dyingMessage
> >     answer dyingMessage
> >     exit to top
> > end die
> >
> >
> >
> > On Thursday, August 28, 2014 2:59:04 PM, JB <[hidden email]>
> 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
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode

>
> >
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
JB
Reply | Threaded
Open this post in threaded view
|

Re: join columns

JB
In reply to this post by Phil Davis-5
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 <[hidden email]> 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
>> [hidden email]
>> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
JB
Reply | Threaded
Open this post in threaded view
|

Re: join columns

JB
In reply to this post by Alain Farmer
Hi Alain,

I am having trouble getting it to insert the column.
Here is the code I am using to access your function.

local dataToInsert, intoThisTable

on mouseUp
   put fld id 1056 into pData
   split pData by column
     put pData[4] into dataToInsert
   put insertAsColumn (3, dataToInsert, intoThisTable) into newTable
   put newTable into fld id 4738
end mouseUp

It puts the dataToInsert into id 4738.
What am I doing wrong here?

John Balgenorth


On Aug 28, 2014, at 2:11 PM, Alain Farmer <[hidden email]> wrote:

> Improved it again :
>
> function insertAsColumn colNumber, dataToInsert, intoThisTable
>     --
>     if dataToInsert is empty then
>         answer "insert empty column ?" with "cancel" or "insert"
>         if it is "cancel" then exit to top
>     end if
>     --
>     if intoThisTable is empty then return dataToInsert
>     --
>     if the number of lines of dataToInsert is not the number of lines of intoThisTable
>     then die "Error: Lists have different lengths."
>     --
>     set the itemdel to tab
>     put the number of items of line 1 of intoThisTable into lastCol
>     if (colNumber < 1) or (colNumber > lastCol) then
>         ask "colNumber must be an integer between 1 and" && lastCol with 1
>         if the result is "cancel" then exit to top
>         if (it is empty) or (it is not a number)
>         then die "colNumber must be an integer between 1 and" && lastCol
>     end if
>     --
>     if colNumber is lastCol then
>         repeat for each line x in dataToInsert
>             get line x of dataToInsert
>             put tab & it after line x of intoThisTable
>         end repeat
>     else
>         repeat for each line x in dataToInsert
>             get line x of dataToInsert
>             put it & tab before item colNumber of line x of intoThisTable
>         end repeat
>     end if
>     --
>     return intoThisTable
>     --
> end insertAsColumn
>
> on die dyingMessage
>     answer dyingMessage
>     exit to top
> end die
>
>
>
> On Thursday, August 28, 2014 4:04:10 PM, Magicgate Software - Skip Kimpel <[hidden email]> wrote:
>
>
>
> Haha. I like the paranoid version :)
>
> SKIP
>
>
> On Thu, Aug 28, 2014 at 3:53 PM, Alain Farmer <[hidden email]>
> wrote:
>
>> Here is the paranoid version :
>>
>> function insertAsColumn colNumber, dataToInsert, intoThisTable
>>      --
>>      if dataToInsert is empty then
>>          answer "insert empty column ?" with "cancel" or "insert"
>>          if it is "cancel" then exit to top
>>      end if
>>      --
>>      if intoThisTable is empty then return dataToInsert
>>      --
>>      if the number of lines of dataToInsert is not the number of lines of
>> intoThisTable
>>      then die "Error: Lists have different lengths."
>>      --
>>      set the itemdel to tab
>>      put the number of items of line 1 of intoThisTable into lastCol
>>      if (colNumber < 1) or (colNumber > lastCol) then
>>          ask "colNumber must be an integer between 1 and" && lastCol with 1
>>          if the result is "cancel" then exit to top
>>          if (it is empty) or (it is not a number)
>>          then die "colNumber must be an integer between 1 and" && lastCol
>>      end if
>>      --
>>      repeat for each line x in dataToInsert
>>          get line x of dataToInsert
>>          put it & tab before item colNumber of line x of intoThisTable
>>      end repeat
>>      return intoThisTable
>>      --
>> end insertAsColumn
>>
>> on die dyingMessage
>>      answer dyingMessage
>>      exit to top
>> end die
>>
>>
>>
>> On Thursday, August 28, 2014 3:31:30 PM, JB <[hidden email]> wrote:
>>
>>
>>
>> Thank you, Alain!  This example will
>> help me out.
>>
>> John Balgenoth
>>
>>
>> On Aug 28, 2014, at 12:24 PM, Alain Farmer <[hidden email]> wrote:
>>
>>> Correction:
>>>
>>> function insertAsColumn colNumber, dataToInsert, intoThisTable
>>>      --
>>>      if the number of lines of dataToInsert is not the number of lines of
>> intoThisTable
>>>      then die "Error: Lists have different lengths."
>>>      --
>>>      set the itemdel to tab
>>>      repeat for each line x in dataToInsert
>>>          get line x of dataToInsert
>>>          put it & tab before item colNumber of line x of intoThisTable
>>>      end
>>> repeat
>>>      return intoThisTable
>>>      --
>>> end insertAsColumn
>>>
>>> on die dyingMessage
>>>      answer dyingMessage
>>>      exit to top
>>> end die
>>>
>>>
>>>
>>>
>>> On , Alain Farmer <[hidden email]> wrote:
>>>
>>>
>>>
>>> on insertAsColumn colNumber, dataToInsert, intoThisTable
>>>      --
>>>      if the number of lines of dataToInsert is not the number of lines of
>> intoThisTable
>>>      then die "Error: Lists have different lengths."
>>>      --
>>>      set the itemdel to tab
>>>      repeat for each line x in dataToInsert
>>>          get line x of dataToInsert
>>>          put it & tab before item colNumber of line x of intoThisTable
>>>      end
>>> repeat
>>>      return intoThisTable
>>>      --
>>> insertAsColumn
>>>
>>> on die dyingMessage
>>>      answer dyingMessage
>>>      exit to top
>>> end die
>>>
>>>
>>>
>>> On Thursday, August 28, 2014 2:59:04 PM, JB <[hidden email]>
>> 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
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>>
>>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
JB
Reply | Threaded
Open this post in threaded view
|

Re: join columns

JB
That was wrong.  It should be,  But it does
not give me a whole table.

on mouseUp
  put fld id 1056 into intoThisTable
  split intoThisTable by column
    put intoThisTable[4] into dataToInsert
  put insertAsColumn (3, dataToInsert, intoThisTable) into newTable
  put newTable into fld id 4738
end mouseUp
On Aug 28, 2014, at 2:49 PM, JB <[hidden email]> wrote:

> on mouseUp
>   put fld id 1056 into pData
>   split pData by column
>     put pData[4] into dataToInsert
>   put insertAsColumn (3, dataToInsert, intoThisTable) into newTable
>   put newTable into fld id 4738
> end mouseUp

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

Phil Davis-5
In reply to this post by JB
Hi John,

It should work if you just say "combine pData by column" and nothing
more. At least it does here - just tested it. It restructures the pData
array back into its original list format, but with items moved to their
new positions.

Phil


On 8/28/14, 2:27 PM, JB wrote:

> 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 <[hidden email]> 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
>>> [hidden email]
>>> 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
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
JB
Reply | Threaded
Open this post in threaded view
|

Re: join columns

JB
Hi Phil,

Thank you so many times!!!

It does work.  I was thinking i needed to add more to it
and never tried it like it was.

This is my first time with arrays.  So I was looking around
for infö and in the process came up with a good lesson on
arrays.

http://revolution.byu.edu/arrays/introToArrays.php

Thanks again!

John Balgenorth

On Aug 28, 2014, at 3:43 PM, Phil Davis <[hidden email]> wrote:

> Hi John,
>
> It should work if you just say "combine pData by column" and nothing more. At least it does here - just tested it. It restructures the pData array back into its original list format, but with items moved to their new positions.
>
> Phil
>
>
> On 8/28/14, 2:27 PM, JB wrote:
>> 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 <[hidden email]> 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
>>>> [hidden email]
>>>> 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
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: join columns

Phil Davis-5
Arrays are great for many uses! I'm glad you got it to work. The BYU
lessons are a good place to learn a lot.

Phil


On 8/28/14, 3:47 PM, JB wrote:

> Hi Phil,
>
> Thank you so many times!!!
>
> It does work.  I was thinking i needed to add more to it
> and never tried it like it was.
>
> This is my first time with arrays.  So I was looking around
> for infö and in the process came up with a good lesson on
> arrays.
>
> http://revolution.byu.edu/arrays/introToArrays.php
>
> Thanks again!
>
> John Balgenorth
>
> On Aug 28, 2014, at 3:43 PM, Phil Davis <[hidden email]> wrote:
>
>> Hi John,
>>
>> It should work if you just say "combine pData by column" and nothing more. At least it does here - just tested it. It restructures the pData array back into its original list format, but with items moved to their new positions.
>>
>> Phil
>>
>>
>> On 8/28/14, 2:27 PM, JB wrote:
>>> 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 <[hidden email]> 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
>>>>> [hidden email]
>>>>> 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
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> 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
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
JB
Reply | Threaded
Open this post in threaded view
|

Re: join columns

JB
Your sample has opened the door to arrays for me.
I love arrays now that I know how to use them.

thanks a lot!

John Balgenorth


On Aug 28, 2014, at 5:51 PM, Phil Davis <[hidden email]> wrote:

> Arrays are great for many uses! I'm glad you got it to work. The BYU lessons are a good place to learn a lot.
>
> Phil
>
>
> On 8/28/14, 3:47 PM, JB wrote:
>> Hi Phil,
>>
>> Thank you so many times!!!
>>
>> It does work.  I was thinking i needed to add more to it
>> and never tried it like it was.
>>
>> This is my first time with arrays.  So I was looking around
>> for infö and in the process came up with a good lesson on
>> arrays.
>>
>> http://revolution.byu.edu/arrays/introToArrays.php
>>
>> Thanks again!
>>
>> John Balgenorth
>>
>> On Aug 28, 2014, at 3:43 PM, Phil Davis <[hidden email]> wrote:
>>
>>> Hi John,
>>>
>>> It should work if you just say "combine pData by column" and nothing more. At least it does here - just tested it. It restructures the pData array back into its original list format, but with items moved to their new positions.
>>>
>>> Phil
>>>
>>>
>>> On 8/28/14, 2:27 PM, JB wrote:
>>>> 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 <[hidden email]> 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
>>>>>> [hidden email]
>>>>>> 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
>>>>> [hidden email]
>>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> [hidden email]
>>>> 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
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode