Using Conditional Expressions
You can create conditional expressions for any data field, including summary fields and any data group.
-
Specify this information:
From the Insert menu, select Expression. The Value Expression dialog is displayed. The Value Expression dialog can only be called in Report Designer, it is not available at run-time entry. Therefore where the parameter condition type is expression, you must have a fixed default value. The default value cannot be blank and the Fixed option has to be checked.
- To create a conditional expression, from the Default tab in the Value Expression dialog, click Add Case. This creates a Case tab. When you have finished adding conditions and cases, click OK to save your changes and close the Value Expression dialog.
-
Specify this information:
- Creating Cases
-
From the Value field on the Case tab, click the browse button to open the Enter Field/Expression dialog where you can create an expression. Alternatively, type a value or expression directly into the Value field.
In the Description field, type a description of the case for your future reference.
Select either the Standard Filter or Custom Expression option.
- Adding Standard Filters
-
If you select Standard Filter, click the Add Condition button to add a new line to the Standard Filter list box.
In the Value column, either add a value, or use the browse button to select a field or create an expression from the Enter Field/Expression dialog.
In the Condition column, either keep the default value of '=' equals as it is, or click the field and from the drop-down list select another condition.
In the Expression column, click the field and then type a value directly into it, or use the browse button to open the Enter Field/Expression dialog where you can select a field or create an expression. When the Value column contains an appropriate field type, an additional browse button allows you to select and return a lookup value.
Uwaga: When entering literal values in the Expression column, ensure that they are enclosed in quotation marks otherwise they may not be evaluated correctly.You can add as many conditions as you like. The case is satisfied when all of the conditions are true.
- Deleting Conditions
-
To delete a condition, from the Value Expression dialog, Case tab, click the Delete Condition button.
Follow the instruction text on the dialog to help you to create a conditional expression.
- Custom Expressions
-
You can enter your own custom expression directly into the text box for this option.
Uwaga: If you enter a standard filter before selecting this option, the standard filter expression is copied into the Custom Expression field. - Multiple Cases
-
Each case is given a number when it is added to the Value expression. The case number is shown on the tab and represents the order in which the expressions are evaluated. For example Case 2 is evaluated before Case 3 and after Case 1.
You can change the order of cases by using the left and right arrow buttons at the bottom of the Value Expression dialog. This moves the case to the next tab, in the direction of the arrow button you have selected.
Uwaga: You can also copy cases to create another similar case using the Copy Case button