User Guide and Reference

Using Property Formulae

Hide Navigation Pane

Using Property Formulae

Previous topic Next topic No directory for this topic  

Using Property Formulae

Previous topic Next topic Topic directory requires JavaScript JavaScript is required for the print function  

Overview

The following scripting constructs, the property formulae, only apply while the form is being generated. When generation is complete, the fom is then delivered to the user, either as HTML the browser or as XFA to Acrobat reader (or some other reader) or to a pdf browser internal module or plugin.

 

These property formulae allow you to query the build environment, to inspect a form field, to find a field in the form hierarchy, perform some string manipulations, and other useful functions.

 

They do not trigger anything while the form is running and only affect the time it takes to serve a form.

 

$BUILD

Call

Result

$BUILD(ENVIRONMENT)

Returns the values of the called arguments:

ENVIRONMENT

VERSION

REVISION

$BUILD(VERSION)

$BUILD(REVISION)

 

$CHAR

$CHAR is a convenience to specify characters, in a text field for example, that would normally are parsed in JavaScript.

Call

Result

$CHAR{COMMA}

Returns a comma character ','

$CHAR{DOT}

Returns a dot character '.'

$CHAR{SLASH}

Returns a slash character '/'

 

$DATA

Call

Result

$DATA(ROOT)

Returns the root element of the form:

E.g. "/AvokaSmartForm"

 

$ENCODE

Call

Result

$ENCODE{SCRIPT,value}

Encodes the value so it can placed in a javascript string literal

$ENCODE{RICHTEXT,value}

Replaces richtext markup with its form specific implementation

$ENCODE{URL,value}

URL encodes the supplied value

$ENCODE{XML,value}

Encodes the value with XML markup entities

$ENCODE{STRIP,value}

Removes richtext markup

$ENCODE{TRIM,value}

Removes cr, lf characters, leading and trailing spaces

$ENCODE{UPPER,value}

Converts the value to uppercase

$ENCODE{LOWER,value}

Converts the value to lowercase

$ENCODE{FNNAME,value}

Converts the value to a valid javascript function name by replacing invalid chars with _

 

Note: $ENCODE is unique among the property formulae, in that you can specify multiple values, pipe-delimited. For example: "$ENCODE{TRIM|UPPER,value}", will first trim the string (i.e. remove any leading or trailing space characters) offered as the "value" and then convert the characters to upper case. The order of these pipe-separated arguments is important, as changing the order of them my affect the output. Note that these are executed from left to right.

 

$FIELD

Call

Result

$FIELD{TYPE}

returns the type of the current field if any

$FIELD{TYPE,relativeUid}

returns the type of the field at the relative uid

$FIELD{TYPE,relativeUid,typeName}

returns 'true' if the type of the field at the relative uid is an instance of the supplied type name



$FIELD{VALUE}

returns the value of the current property of the current field

$FIELD{VALUE,typeName}

returns the value of the current property as defined in the specified type



$FIELD{RBTYPE}

For radio buttons only, indicates whether the buttons value is controlled by the group or by the button

returns 'group' for group controlled buttons (case 1&2)

returns 'button' for button controlled buttons (case 3)

$FIELD{RBTYPE,buttonType}

For radio buttons only

returns true if the button type (as deternmined by $FIELD{RBTYPE}) matches the supplied type.



$FIELD{INSTANCEMANAGER}

returns the relative uid of the closest parent instance manager or blank if not found

$FIELD{NESTLEVEL}

returns the number of repeat instances this field is nested inside of

$FIELD{INDEX}

returns the index of the field as a child of its parent

$FIELD{REVERSEINDEX}

returns the reverse index of the field wrt its parent

$FIELD{ISFIRST}

returns true if this field is the first child of its parent

$FIELD{ISLAST}

returns true if this field is the last child of its parent

$FIELD{CHILDCOUNT}

returns the number of child fields

$FIELD{HASCHILDREN}

returns true if the field has at least 1 child

$FIELD{RESOURCE,resName}

returns the contents of the given resource applying formula substitutions with the context of the current field.

 

$FIND

Call

Result

$FIND{propertyname}

Searches from the current context up the hierachy for a property with the given name and returns the value of the first one found. If a property isn't found then a blank string is returned.

 

E.g. $FIND{section.name} returns the section name from within any child field of the section

$FIND{path,propertyname}

Sames as $FIND{propertyname} but the upwards search begins from the field found at the relative path provided. If no field can be found at the supplied path then a blank string is returned.

 

e.g. $FIND{../../someField,label}

 

$FLOAT

TBA

$FORM

Call

Result

$FORM(NAME)

Returns the form's values of the called argument

$FORM(DESCRIPTION)

$FORM(RELEASE)

$FORM(TEMPLATE)

 

$GENERATION

Call

Result

$GENERATION(TECHNOLOGY)


$GENERATION(FLAVOUR)


$GENERATION(FLAVOR)


$GENERATION(TARGET)


$GENERATION(VARIANT)


$GENERATION(UUID)


$GENERATION(TIMESTAMP)


$GENERATION(DATE)


$GENERATION(DEBUG)


$GENERATION(DEBUGSCRIPT)


 

$IF

TBA

 

$INFO

Call

Result

$INFO(USER)

Returns the form's info values of the called arguments

$INFO(ACCOUNT)

$INFO(CLIENT)

$INFO(ORGANISATION)

$INFO(ORGANIZATION)

$INFO(PROJECT)

$INFO(SERVER)

$INFO(ENVIRONMENT)

 

$LIST

Call

Returns

$LIST{CONTAINS,list,value,separator}

Returns true if the list contains the value

$LIST{INDEXOF,list,value,separator}

Returns the 0 based index of the value within the list

$LIST{ITEMAT,list,index,separator}

Returns the item at 0 based index position within the list

$LIST{SIZE,list,separator}

Returns the size of the list

 

$LOCALE

Call

Result

$LOCALE(LANGUAGE)

Returns the form's locale values of the called arguments

$INFO(COUNTRY)

$INFO(CODE)

 

$LOOKUP

TBA

$MATH

Call

Result

$MATH{PX,value}

Converts the value to pixels and strips the units

$MATH{IN,value}

Converts the value to inches and strips the units

$MATH{MM,value}

Converts the value to millimetres and strips the units

$MATH{MAX,value,...}

Returns the largest value - if the first value has units then the result is returned in those units

$MATH{MIN,value,...}

Returns the smallest value - if the first value has units then the result is returned in those units

$MATH{SUM,value,...}

Returns the sum of the supplied values - if the first value has units then the result is returned in those units

$MATH{PRODUCT,value,...}

Returns the product of the supplied values (multiplies them together) - if the first value has units then the result is returned in those units

$MATH{HALF,value}

Returns half of the supplied value - if the value has units then the result is returned in those units

$MATH{TWICE,value}

Returns twice of the supplied value - if the value has units then the result is returned in those units

$MATH{MARGIN,value}

Converts a composer margin to a technology supported margin

 

$RULE

Call

Result

$RULE{TRIGGER,rulename)

Returns the trigger width in pixels for the given rule

 

$SEQUENCE

Call

Result

$SEQUENCE{Sequence argument, Sequence argument1, ......, RESET)

Resets the named sequences.

$STRING

Call

Result

$STRING{CONTAINS,value,pattern}

 

Returns true if the value contains the pattern as a substring

$STRING{INDEXOF,value,pattern}

Returns the 0 based index of the pattern within the value or -1 if not found.

 

$TEST

Call

Result

$TEST{BLANK,value}

Returns true if the supplied value is blank

$TEST{NOTBLANK,value}

Returns true if the supplied value is not blank

$TEST{EQUALS,value1,value2}

Returns true if value1 and value2 are the same

$TEST{NOTEQUALS,value1,value2}

Returns true if the value1 and value2 are not the same

$TEST{NOT,value}

Returns true if value is the literal false otherwise returns false

$TEST{AND,value1,value2}

Returns true if value1 and value2 are both the literal true

$TEST{OR,value1,value2}

Returns true if value1 or value2 are the literal true

$TEST{LESSTHAN,value1,value2}

Returns true if value1 as a number is less than value 2 as a number

$TEST{GREATERTHAN,value1,value2}

Returns true if value1 as a number is greater than value 2 as a number