Defining Expressions

You can define expressions in XMPie’s QLingo language or using SQL or JavaScript. The QLingo language is very similar to Visual Basic or scripting languages, but is much easier to use. QLingo is fully compatible with SQL and provides full functionality with relational databases. Using programming constructs such as If/Then/Else or Switch, enables easier, simpler, yet more powerful rule specification. Each expression represents a single QLingo statement; each QLingo statement defines or calculates a value. A detailed description of the QLingo language appears in QLingo Language.

You can define two types of expressions:

  • Read: enables you to define an expression that is used to calculate an ADOR value.

  • Write: enables you to define an expression that is used to update database entries based on the calculated ADOR value.

Naturally, you can use the wide range of QLingo operators and expressions when using ADORs whose expression type is set to Read. However, for the sole purpose of using Write expressions, you are required to use a unique QLingo operator – the Assignment operator. More on this operator is available in Assignment.

To open a Read/Write Expression tab:

  • From the ADOR Object list, right-click an ADOR and select Edit Read Expression or Edit Write Expression.

Naturally, you should make sure the ADOR you select supports the Expression type you choose. For more details on setting up expression types, refer to Set up the ADOR Read/Write Properties.

Edit Expressions

When you work with a plan object that supports expressions (for example, ADOR, variable, etc.), you can edit or modify the objects using Expression windows.

To edit the expression for a plan object, do one of the following:

  • Right-click the object you wish to edit, and choose Edit Read Expression(or Edit Write Expression, depending on the expression type of the ADOR) from the menu displayed.

  • Click the icon on the toolbar and use the submenus to select the object whose expression you wish to edit.

  • Double-click the icon to the left of the object.

An Expression window opens, allowing you to define a new expression or modify an existing expression. More than one Expression window can be opened concurrently and for various types of objects.

Various tools are available to assist you while you edit or define expressions. You can insert predefined QLingo functions from the Templates list (see Working with Templates), and construct Expressions with objects from user-defined views, data sources, and plan variables.

Before closing the Expression window, you can revert to the last saved version of the current expression, should you want to undo any major editing. After defining the expression, you can check the validity of the expression. The system will attempt to pinpoint the location of any errors and includes a reference to the most likely location.

More topics

Defining an INSERT Expression