This tutorial demonstrates how to change a label's text if a certain condition is met, without using scripts.

To conditionally change a label's text, do the following.

  1. Create a new report and bind it to a data source.

  2. To create a calculated field, in the Field List, right-click any item inside the created dataset, and on the invoked menu, choose Add Calculated Field.

  3. Select the calculated field, and in the Property Grid, set its Field Type to String. Then, click the ellipsis button for its Expression property.

    And, in the invoked Expression Editor, define the required logical condition for the calculated field (e.g. Iif([UnitsOnOrder] == 0, 'None', [UnitsOnOrder]), which means that if the UnitsOnOrder data field's value is equal to 0, the control's text will be replaced with None).

    To save the changes and close the dialog, click OK.

  4. Finally, drop the required data fields (and the created calculated field as well) from the Field List onto the report's Detail band.

The report is now ready. Switch to the Preview Tab, and view the result.

Expand imageSee Also