Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Global Binding and add row query

KerryC08
Level 1
Level 1

I have two tables.  In table 1 I have global binding to text fields to duplicate data into table 2. In table 1 I have an 'add row' button.  I would like to know how, when I add a row, to not have the text from the row above appear in the new row

3 Replies
Bernd_Alheit
Level 3
Level 3

Try the forum for LiveCycle Designer.

_Bruce_Robertson
Level 10
Level 10

Hi,

I don't believe you can achieve what you want with global binding, this has the effect of assigning all fields with the same name the same value and as the fields in the second row will have the same names as fields in the first row, they will also have the same values.

One way of achieving what you want it to have a calculate event script in the second table that copies values over, something like;

var rows = xfa.resolveNodes("Table1.Row1[*]");

_Row1.setInstances(0);      // make sure min count is zero

for (var i = 0; i < Table1._Row1.count; i++) {

      var sourceRow = rows.item(i);

      var sourceFields = sourceRow.resolveNodes("#field[*]");

      var destinationRow = _Row1.addInstance();

      for (var j = 0; j < sourceFields.length; j++) {  

           var sourceField = sourceFields.item(j);

           var destinationField = destinationRow.resolveNode(sourceField.name + "[" + sourceField.index + "]");

           if (destinationField !== null) {

                destinationField.rawValue = sourceField.rawValue;

           }

      }

}

You will have to change the names for the first table (Table1 in this code) and the row in the first table (Row1), here is a sample form https://sites.google.com/site/livecycledesignercookbooks/home/CopyTable.pdf?attredirects=0&d=1

Regards

Bruce