Try Xenarius Free

Functions

With Xenarius, applications are designed declaratively but with its Visual Function Editor, you can inject a more procedural approach and therefore manage specific usage scenarios (such as handling events or processing data in a unique manner).

Xenarius allows you to create functions for the following:

  • Function type properties including editor properties, view model properties, data source calculated field properties. These properties have an ellipsis button in the view editor. Click it to open the function editor.

  • Global functions that are available to the entire application. You can use them within properties of the function type. To create a global function, click the Global Functions button on the main toolbar and select Create a new global function. This invokes the function editor.

Function Editor

Use the Name field to specify the name of the function. This field is available only for global functions.

Then, use the Add button to add operators to the function body. Note that operators within the function will be executed in the linear order.

To reorder operators, use drag-and-drop.

Some operators can include a number of other operators - you can identify them by the Add button displayed at their right side. Click it to add an operator inside.

To remove an operator, click the Cross button.

You can declare local variables using the right panel. Expand the Variables section and click Add to add a declaration. Variables expose the following properties.

  • Name – specifies the variable name.

  • Type - choose from standard data types, arrays of standard data types, and object types specified in an application’s data providers.

  • Default Value – specifies the default variable value according to the variable type.

For global functions, you can also declare parameters. In the right panel, expand the Parameters section and click Add, then specify the parameter name.

You can also access view models from within functions (the global model from all functions, and the current view model from functions defined within a view). Use the $model and $global prefixes to do this.

If a function is executed against a data record (these can be event handlers for data-aware editors, like the OnItemClick event handler for the list, or functions used to compute values of calculated fields in a data source), you can also use the $data prefix to access the current data record.

In property setter functions, you can also use the $value variable to reference the value being assigned to the property.

Some operators imply the declaration of certain variables inside them. For instance, the Loop operator provides the loopIndex and loopValue variables, so that you can use them to refer to the current index and value.