XFA Specification
Chapter 23, FormCalc Specification
Grammar and Syntax
821
Comparing References for Equality and Inequality
Comparing references for equality and inequality involves comparing the handles of the referred-to
objects, and not their values. It's an object comparison.
var p = Ref(Price)
var q = p
// If Price is a valid object then the above
// references will both refer to the same object.
//
if (p == q) then
...
endif
Qualifying References by an Accessor or Method
References may be further qualified by an accessor or method as in:
var p = Ref(Price)
p.Parent
p.getParent()
and, for reference:
var q = Ref(Price[1])
the following assignment expressions each set the value of field
Price[1]
to the value of field
Price[2]
.
q = Price[2]
q.#value = Price[2]
q..setValue(Price[2])
Other Reference Uses
In all other contexts, a reference simply refers to the value of the object it refers to. This further implies that
for most built-in functions, passing a reference argument is equivalent to passing the value of the object
the reference refers to. For example, the following expressions both return the absolute value of object
Total
.
Abs(Ref(Total))
Abs(Total)
Control Expressions
Break Expressions
92 BreakExpression ::= 'break'
A break expression causes an immediate exit from the innermost enclosing
while
,
for
, or
foreach
expression loop. Control passes to the expression following the terminated loop.
Example 23.1 Total the receipts up to a maximum value, using continue and break expressions
var total = 0.0
foreach receipt in ( travel_receipt[*], parking_receipt[*] ) do
if (receipt lt 5) then
continue
// Causes a jump to the next iteration of the foreach loop.
endif
total = total + receipt
if (total gt 1000) then
total = 1000
break
// Causes execution to drop out of the foreach loop.
endif
endfor
The value of the break expression is always the value zero (0).
Home Index Bookmark Pages
Pages: Home Index All Pages