You can add
or remove tables, body rows, header rows, and footer rows by adding
instance manager scripting expressions to objects on your form by
using the Script Editor.
Before you begin, make sure that you perform the following tasks:
If
it is not already visible, display the Script Editor by selecting
Windows > Script Editor. Expand the Script Editor so that it
is displayed in multiline view.
Ensure that the table to add instances to is contained within
a flowed subform so that you can add new instances of either the
table or the rows within the table.
To add a table or table row instance to a form
Select
the object on your form design to add the script to, and select
an event from the Show list in the Script Editor.
Type one of the following scripts in the Script Editor, where Table1 and Row1 are
the names of the table and table row to add instances to:
FormCalc
Table1.instanceManager.addInstance(true) // Default instance manager syntax
Table1.Row1.instanceManager.addInstance(true) // Default instance manager syntax
xfa.form.recalculate(true) // Invoke the recalculate method to include the field values from the added table or row in the form calculations.
or
Table1.addInstance(true) // Short form of the instance manager syntax
Table1._Row1.addInstance(true) // Short form of the instance manager syntax
xfa.form.recalculate(true) // Invoke the recalculate method to include the field values from the added table or row in the form calculations.
JavaScript
Table1.instanceManager.addInstance(true); // Default instance manager syntax
Table1.Row1.instanceManager.addInstance(true); // Default instance manager syntax
xfa.form.recalculate(true); // Invoke the recalculate method to include the field values from the added table or row in the form calculations.
or
Table1.addInstance(true); // Short form of the instance manager syntax
Table1._Row1.addInstance(true); // Short form of the instance manager syntax
xfa.form.recalculate(true); // Invoke the recalculate method to include the field values from the added table or row in the form calculations.
To remove a table or table row instance from your form
Select the object on your form design to add the script to,
and select an event from the Show list in the Script Editor.
Type one of the following scripts in the Script Editor, where Table1 and Row1 are
the names of the table and table row to remove instances from and integer is
the zero-based index number of the instance to remove:
FormCalc
Table1.instanceManager.removeInstance(true) // Default instance manager syntax
Table1.Row1.instanceManager.removeInstance(true) // Default instance manager syntax
or
Table1.removeInstance(true) // Short form of the instance manager syntax
Table1._Row1.removeInstance(true) // Short form of the instance manager syntax
JavaScript
Table1.instanceManager.removeInstance(true); // Default instance manager syntax
Table1.Row1.instanceManager.removeInstance(true); // Default instance manager syntax
or
Table1.removeInstance(true); // Short form of the instance manager syntax
Table1._Row1.removeInstance(true); // Short form of the instance manager syntax