Expand my Community achievements bar.

Trying to copy table row from one table to another using button.

Avatar

Level 1

I have two dynamic tables. Table 1 contains a list of to do items and  I want to move items completed to another table (Table 2) using a button that is incorporated into the table.

I have broken the task down into three sections:

1.     add a new row to Table 2 - this is working

2.     copy or move the appropriate row to the new table - NOT WORKING

3.     delete the old (now empty row) from Table 1 - not got to this yet.

Here is the script from the Click event:

          form1.Pg1.Table1.Row1.Btn_Completed::click - (JavaScript, client)

          //Step 1 Add a line to Table 2

          this.resolveNode('Pg2.Table2._Row1').addInstance(); //this works 12/13/17 14:45

          Pg2.Table2.Row1.itemDescription.rawValue = form1.Pg1.Table1.Row1.itemDescription.rawValue;

I have got it working somewhat but it only copies the first row. Any help greatly appreciated!

till a bit of a newbie at this. Using LC ES4

1 Reply

Avatar

Level 7

Hi,

You need to reference the correct instance in the table.

Even though the table will physically have two rows when you look at it, the second row will be an instance of Row1. It is still called Row1 but with the instance specified.

The first repeating row instance will be - form1.Pg1.Table1.Row1[0].itemDescription.rawValue

then

form1.Pg1.Table1.Row1[1].itemDescription.rawValue //row 2

form1.Pg1.Table1.Row1[2].itemDescription.rawValue //row 3

and so on

I have highlighted the difference above. The same can be used when deleting a specific row.