Conditionally change label text
This procedure demonstrates how to change label text if a certain condition is met.
- Create a new report.
-
In the Field List, right-click any item inside the new dataset, and click Add Calculated Field.
-
In the Property Grid, set the field's Field
Type property to String, then click the
browse button (...) for the
Expression property.
This opens the Expression Editor dialog box.
-
In the Expression Editor dialog box, define the required
condition for the calculated field, and then click
OK.
Example For example, Iif([UnitsOnOrder] == 0, 'None', [UnitsOnOrder], which specifies that if the UnitsOnOrder data field's value is equal to 0, the appropriate control's text will be replaced with None.
-
Drag the required data fields (and the created calculated field as well) from
the Field List onto the report's
Detail band.
For m more information, see Report bands.
-
The report is now ready. Switch to the Preview tab, and
view the result.