Move table row contents to another table

34 views
Skip to first unread message

Martyn Draper

unread,
Dec 14, 2017, 12:10:57 PM12/14/17
to Adobe LiveCycle Developers

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!

 

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

I have the same question (0)

fred.pantalone

unread,
Dec 15, 2017, 11:29:51 AM12/15/17
to Adobe LiveCycle Developers
Hi Martyn,

You have to loop through all of the rows in the source table. Do you have any programming experience?

Fred

Martyn Draper

unread,
Dec 18, 2017, 5:40:47 PM12/18/17
to Adobe LiveCycle Developers
Hi Fred

No programming experience, but I'm willing to try!

fred.pantalone

unread,
Dec 19, 2017, 3:08:33 PM12/19/17
to Adobe LiveCycle Developers
Martyn,

To start, you should probably name your rows without a number in them since they are dynamic and the number doesn't make sense (i.e. every row will be known as "Row1") but this is a minor detail.

To control the loop, you need to know how many items are in the source table:

var rowCount = Pg1.Table1._Row.count;

for (var ii = 0; ii < rowCount; ii++)

{

   var newRow = Pg2.Table2._Row.addInstance(); // add a row to Table2

   newRow.itemDescription.rawValue = Pg1.Table1.resolveNode("Row[" + ii + "]").itemDescription.rawValue; // copy content from Table1 to Table2

}


See if you can get this code working before you move on.

Fred
Reply all
Reply to author
Forward
0 new messages