Re: join columns

2014-08-28 Thread 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 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. > >

Re: join columns

2014-08-28 Thread Phil Davis
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 ti

Re: join columns

2014-08-28 Thread 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/introToArra

Re: join columns

2014-08-28 Thread Phil Davis
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 h

Re: join columns

2014-08-28 Thread 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

Re: join columns

2014-08-28 Thread JB
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, into

Re: join columns

2014-08-28 Thread JB
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?

Re: join columns

2014-08-28 Thread 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 dataTo

Re: join columns

2014-08-28 Thread Magicgate Software - Skip Kimpel
Haha. I like the paranoid version :) SKIP On Thu, Aug 28, 2014 at 3:53 PM, Alain Farmer wrote: > Here is the paranoid version : > > function insertAsColumn colNumber, dataToInsert, intoThisTable > -- > if dataToInsert is empty then > answer "insert empty column ?" with "cancel"

Re: join columns

2014-08-28 Thread 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 re

Re: join columns

2014-08-28 Thread JB
Thank you, Alain! This example will help me out. John Balgenoth On Aug 28, 2014, at 12:24 PM, Alain Farmer wrote: > Correction: > > function insertAsColumn colNumber, dataToInsert, intoThisTable > -- > if the number of lines of dataToInsert is not the number of lines of > intoThisTa

Re: join columns

2014-08-28 Thread JB
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 wrote: > Before doing the 'split', you could set the columnDelimiter to whatever char > is used as the item delimiter. In other words, y

Re: join columns

2014-08-28 Thread 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

Re: join columns

2014-08-28 Thread Alain Farmer
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

Re: join columns

2014-08-28 Thread Phil Davis
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

Re: join columns

2014-08-28 Thread JB
Thanks a whole bunch, Phil !!! John Balgenorth On Aug 28, 2014, at 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 >

Re: join columns

2014-08-28 Thread Phil Davis
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 toget