XFA Specification
Chapter 23, FormCalc Specification
Grammar and Syntax
817
MyFunction(3) //Invokes the function, which returns 9
Assignment Expressions
86 Expression ::= AssignmentExpression | ...
87 AssignmentExpression ::= Accessor '=' SimpleExpression
An AssignmentExpression
[
87
90
SimpleExpression
67
The value of the AssignmentExpression
87
67
Accessors
88 PrimaryExpression ::= Accessor ( '.*' )
?
| ...
89 AssignmentExpression ::= Accessor '=' SimpleExpression
| ...
90 Accessor ::= Container | Accessor [ '.' '..' '.#' ] Container
91 Container ::= Identifier | Identifier '[' '*' ']'
Identifier '[' SimpleExpression ']' | MethodCall
|
FormCalc
provides access to object properties and values, which are all described in
“Scripting Object
Model” on page 81.
An Accessor
90
assigned, when used on the left-hand side of an AssignmentExpression
89
SimpleExpression
67
Invoice.VAT = Invoice.Total * (8 / 100)
Accessors may consist of a fully qualified hierarchy of objects, as in:
$form.subform.subform.field[10].Price = "255.99"
and optionally followed by an object property, as in:
Invoice.border.edge[1].color.#value = "255,9,9"
The object property is indicated by the use of the '.#' separator.
Accessors may equally consist of a partially qualified hierarchy of objects, again optionally followed by an
object property, as in:
Invoice..edge[1].color.#value = "255,9,9"
The hierarchy is indicated by the use of the '..' separator.
When terminated with the '.*' separator, instead, what is referred to is the collection of sub-objects of the
object identified by the accessor.
A container is simply the name of an object or object property.
A hierarchy of objects presupposes the architectural model described in
“Scripting Object Model” on
page 81.
Such a model is important because there can be multiple instances of objects with the same
name on a form, each instance gets assigned an occurrence number, starting from zero. To refer to a
specific instance of an object which bears the same ambiguous name as other objects, it is required that
the name be qualified by an occurrence number corresponding to the desired ordinal instance of the
object.