Implement a Custom Expression Property

Edit in →

Expressions allow survey creators to manage data flow and visual elements within a survey dynamically. Most survey elements have built-in expression properties (visibleIf, enableIf, setValueExpression, etc.). This demo shows how to implement a custom expression property. This property controls the visibility of the table header in a Single-Select Matrix question.

To implement a custom expression property, follow the steps below:

  1. Add a custom property to a desired class.
    Call Serializer's addProperty method, passing a class name and a JSON object with property settings.

  2. Specify the property's name and type.
    Use the "condition" type for Boolean expressions or the "expression" type for other expressions.

  3. Specify the onExecuteExpression function.
    This function will be called each time a specified expression is evaluated. This function should assign the evaluation result to one of the class instance properties. For example, in this demo, the result is assigned to the showHeader property of a Single-Select Matrix.

Refer to the code listing for a code example.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.