Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
Level III

## Enter a value in a cell of another table

Hi,

I have two tables. I'm struggling to put a value from one table into the other. I made the value from the first table a variable.

val1=Column(Table1,"Column1")[1];

Column(Table2,"Column2")[1]=val1;

I tried various syntax I found in another discussion thread. This was the last one i tried. It seems to mirror the way i define val1 so it made sense to me that it should work. I can print val1 in the log so i don't think that is the problem. I think something is wrong with the second line beucase that is where the log keeps flagging me. Here is the log:

Column( Table1/*###*/,"Column2")[1]=val1;

Name Unresolved: Table2{1} in access or evaluation of 'Table2', Table2/*###*/

Maybe I should put val1 in another table with the correspoding matching value in Table2. Then update table?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User

## Re: Enter a value in a cell of another table

Here are a couple of exaples of how to do what you are looking for

``````Names Default To Here( 1 );
dt1 = New Table( "Table1",
New Column( "ColA", values( {44, 55} ) )
);

dt2 = New Table( "Table2",
New Column( "ColB", values( {77, 88} ) )
);

Wait(5);

// Transfer from table 1 to table 2 using data table
// pointers
dt1:ColA[1] = dt2:ColB[1];

wait(5);

// Transfer from table 1 to table 2 using data table
// names
column(data table("Table1"),"ColA")[2] =
column(data table("Table2"),"ColB")[2];

// or
//column(dt1,"ColA")[2] =
//	column(dt2,"ColB")[2];``````
Jim
2 REPLIES 2
Highlighted
Super User

## Re: Enter a value in a cell of another table

Here are a couple of exaples of how to do what you are looking for

``````Names Default To Here( 1 );
dt1 = New Table( "Table1",
New Column( "ColA", values( {44, 55} ) )
);

dt2 = New Table( "Table2",
New Column( "ColB", values( {77, 88} ) )
);

Wait(5);

// Transfer from table 1 to table 2 using data table
// pointers
dt1:ColA[1] = dt2:ColB[1];

wait(5);

// Transfer from table 1 to table 2 using data table
// names
column(data table("Table1"),"ColA")[2] =
column(data table("Table2"),"ColB")[2];

// or
//column(dt1,"ColA")[2] =
//	column(dt2,"ColB")[2];``````
Jim
Highlighted
Level III

## Re: Enter a value in a cell of another table

Thank you so much! i'm struggling a lot but also learning a lot. I really appreciate the guidance.
Article Labels

There are no labels assigned to this post.