XFA Specification
Chapter 8, Dynamic Forms
Layout for Dynamic Forms
285
Combining startNew with beforeTarget
The same
break
Before element may have both
startNew
and
target
attributes. This combination
requires the layout processor to fulfill both the
startNew
and
target
conditions, that is, the subform
must be placed in a
pageArea
or
contentArea
that is empty and also corresponds to a template object
which matches the target specification.
Conditional Break on Entry
The breakBefore element may contain a script element. When the script is non-empty it is executed by the
layout processor just before attempting to place the object. The script must return a Boolean value. If the
value is False the before break is inhibited. However if the return value is True the before break is executed.
In the absence of a script the break is always executed.
Scripts can be in any supported language. When the scripting language does not have a formal return
value mechanism the last right-hand value computed by the script is used. This also allows the use of
simple expressions that do not fulfill the syntax requirements for procedures. For example, in the
following template fragment the expression is used to force the report to start a new page whenever the
list of detail records starts a new customer ID:
<subform name="detailLine">
<occur min="0" max="-1"/>
<breakBefore target="#pageX" targetType="pageArea">
<script>
if (exists(Entry[-1]))
then Entry[-1].CustID.value ne Entry.CustID.value
endif
</script>
</breakBefore>
</subform>
Note that the script is, as usual, evaluated in the context of the enclosing subform. The expression used
tests for the existence of the previous record in order to avoid a run-time error on the first record. As a side
effect on the first record the before break is inhibited because the script returns the value False which was
returned by the
exists()
function. For all other records the customer ID for the current and previous
records are compared and the break is executed only when they differ.
Inserting a Trailer
A trailer is an object which is laid down before any other action is carried out. In particular it is laid down
before any movement to another pageArea or contentArea as mandated by the before break. A trailer on
a before break has the same effect as a leader on an after break asserted by the previous layout object.
In the following template fragment a before break trailer is used to lay down a message indicating that the
text is continued overleaf.
<subform name="bigSubform">
<breakAfter targetType="pageArea" trailer="#continued"/>
</subform>
If the
breakBefore
element supplies a script the trailer is only laid down if the script returns True..
Home Index Bookmark Pages
Pages: Home Index All Pages