Global Binding and add row query

Avatar

Avatar

KerryC08

Avatar

KerryC08

KerryC08

14-09-2016

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

Accepted Solutions (0)

Answers (3)

Answers (3)

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

19-09-2016

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

Avatar

Avatar

try67

Avatar

try67

try67

15-09-2016

[Question moved to the LiveCycle Designer forum]

Avatar

Avatar

Bernd_Alheit

Avatar

Bernd_Alheit

Bernd_Alheit

14-09-2016

Try the forum for LiveCycle Designer.