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

Avatar

Avatar

martynd54407871

Avatar

martynd54407871

martynd54407871

13-12-2017

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar

MinusZero

Avatar

MinusZero

MinusZero

14-12-2017

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.