Introduction

Business and UI-logic on forms need to be flexible to fulfil all the possible needs and wishes. Rich Forms provides a powerfull expression language to enable configuring forms freely. Throughout the forms editor expressions can be used to dynamically calculate a value or text given a specific context.

To cater for different uses any expression can be defined in any of the following forms: Template Expressions, Value Expressions, Function Expressions.

Template expressions

Text templates are a special form of expressions in which placeholders are replaced by string representation (always returns a string, placeholders are always converted to string before inserted). Placeholders can contain field paths [[CaseFile.Title]] or expressions [[= Context.Web.Title]] (begin with equals sign).

This form allows to define textual values in a simpler, more abreviated and suitable manner than the other forms. As an example, we can write ‘[[Firstname]] [[Lastname]]’ for a calculation of a text field value, instead of needing the more complex value expression (‘=[[Firstname]] + “ “ + [[Lastname]]’).

​Syntax: Use plain text containing placeholders to insert dynamically calculated text.
Example: Use the expression ‘Welcome [[Firstname]] [[Lastname]]!’ to calculate the text ‘Welcome Mary Hunter!’ when the values of field Firstname and LastName are ‘Mary’ and ‘Hunter’

Assignment expressions

With value expressions we can define texts and values to be calculated using JavaScript-based assignment terms.

​Syntax: The “=” sign at the beginning of expressions signals that it is an assignment expression, otherwise it is evaluated as a template expression. When the assignment expression type has been selected in the expression builder the preceding equals does not need to be typed though. Use placeholders in double square brackets to access a field value or context object​ that is dynamically evaluated.
Example: = [[MyTest]] + ‘ is calculated value’

Function Expressions

Using function expressions more complex calculations can be defined. The expression allows using the full scope of JavaScript code as in bodies of JavaScript functions. Values must be returned using ‘return ;’ statements.

Syntax: Starting with “{” signals that it is a function body expression. In the expression builder the curly brackets don’t need to be typed though. Except for the use of placeholders in double square brackets to inject field values and context information the syntax is the same as used in JavaScript function bodies.
Example: { var myValue = [[Title]]; if (myValue.indexOf(‘Test’) > -1) return “Is Test”; else return myValue; }

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment