EVAL (Macros)

You can write and include macros in your queries. This means you can embed expressions that are parameterized to generate BQL.

You can use macros in expression fields. Select Add Expression Column in Designer.

The macro is executed when the query is constructed, not after the result set has been returned.

Note:  Macros are not supported for saved expressions that are in the Subject Area of Designer or Visualizer.

EVAL Syntax for Macros

The syntax for macros is:

<EVAL!Expression!>

Example EVAL Syntax for a Designer Column Properties Expression

Macros can be used in conjunction with dashboard prompts, such as with GETPROMPTVALUE. For example, determine which version of Quantity to use based on a user-selected prompt answer. If the List prompt brings back “shipped” it shows [ShippedDate: Sum: Quantity]; otherwise, it shows [OrderDate: Sum: Quantity].

In Designer, select Add Expression Column.

Add Expression Column

After the Expression Builder opens, you can specify the expression.

Add Expression Column

Specify this Expression:

([<EVAL!IIF((GetPromptValue('Requested View','shipped')='ordered'),'OrderDate: ','ShippedDate: ')!>Sum: Quantity])

Go to Column Properties:

Going to Column Properties

Specify the remaining properties, as shown here.:

Column Properties