Page 1 of 1

array vs. table

Posted: Thu Oct 01, 2009 3:08 am
by drOrganized
I am a bewildered novice again:

I would like to be able to add new columns to an existing table, or populate particular [row,column] places in a table, and am trying to learn the most efficient way to do this.

In the process, I have a couple of questions:

Is it possible to display a 2 dimensional array into a table? (When I try this I get an error.)
put myArray into field "myTable"

On the other hand can I put the contents of a table into an array variable:
put field "myTable" into myArray
so that I can then update myArray with more data?

Alternatively, is it possible to update the contents of a table with:
put data into field myTable [x,y]

Any suggestions appreciated...

Posted: Thu Oct 01, 2009 1:34 pm
by Klaus
Hi drOrganized,

you need to change the array to a "normal" variable/list:
...
combine myArray by column
put myArray into fld "myTable"
...

Check "combine" and "split" in the docs (Rev Dictionary) to learn more about changing arrays to lists and vice versa.


Best

Klaus

Re: array vs. table

Posted: Fri Oct 02, 2009 3:36 am
by sturgis
drOrganized wrote:I am a bewildered novice again:

I would like to be able to add new columns to an existing table, or populate particular [row,column] places in a table, and am trying to learn the most efficient way to do this.

In the process, I have a couple of questions:

Is it possible to display a 2 dimensional array into a table? (When I try this I get an error.)
put myArray into field "myTable"

On the other hand can I put the contents of a table into an array variable:
put field "myTable" into myArray
so that I can then update myArray with more data?

Alternatively, is it possible to update the contents of a table with:
put data into field myTable [x,y]

Any suggestions appreciated...

Code: Select all

On your "populate a row/column" method question, if I recall correctly, rev treats a table as a regular old field that contains lines and items.  So if you did 

set the itemDelimiter to tab 
-- needed because the table field uses tab as the delim char.
-- if I remember right, the itemdelimeter isn't global, so once the handler is done, it reverts to the default, in this case, the default item delimiter is comma. 

put "This is the 3rd cell of line 1" into item 3 line 1 of fld "myField" 
-- puts the data into the item and line position you specify
you should be able to specify where you want it.

Array v Table

Posted: Fri Oct 02, 2009 3:50 am
by drOrganized
Klaus & Sturgis,

Many thanks!

Dr. O~