Creating Compound Expressions

Monarch Classic lets you create complex expressions, called compound expressions.

Building complex expressions

Compound expressions let you filter the table based on the values in multiple fields. For example, to display transactions for sales of 10 or more CDs, use the expression:


This compound expression returns only those records where the Media field contains CD and the Quantity field contains a value of 10 or greater.

To display transactions for sales of LPs or CDs that were shipped after the 15th of the month, use the expression:

(Media="DVD".Or.Media="CD").And.[Ship Date]>={04/15/2001}

The parentheses surrounding Media="DVD".Or.Media="CD" tell Monarch Classic how to evaluate the expression. Without the parentheses, this expression would return transactions of DVDs for the entire month and transactions for CDs shipped after the 15th.

Also note the brackets around the Ship Date field name. Brackets are required when a field name is longer than 10 characters or when a space is included in a field name. The brackets indicate where the field name begins and ends.

Note: When selecting field names from the Fields list, Monarch Classic adds the brackets automatically when required. However, if you manually type a field name in an expression, you must add the brackets if the field name requires them.

Finally, the braces around 04/15/2001 indicate that this string represents a date value. Otherwise, the string might be interpreted as a mathematical equation.

Using copy and paste to build a complex expression

When creating complex filter or calculated field expressions, it is often easier to break the task into several filters or calculated fields, each with a portion of the expression. When you are satisfied that each portion works on its own, you can combine the expressions into a single expression by copying and pasting information from one expression to another. Select the text in the first expression and press CTRL+C to copy it to the Clipboard. Then, close the dialog and edit the second filter or calculated field. Position the cursor in the expression box where you want the text to appear, then press CTRL+V to paste it in. After combining multiple expressions into a single expression, you can delete the extraneous filters or calculated fields.





© 2024 Altair Engineering Inc. All Rights Reserved.

Intellectual Property Rights Notice | Technical Support