Conditionally Change a Label's Text

In this tutorial, you will learn 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. Now, add a new calculated field. To do this, switch to the Field List panel, click a data table and click Add calculated field button.

    eud-calc-fields-0

  3. Click the Edit button (the 'pencil' icon web-report-designer-edit-query) for the calculated field and set the Field Type property 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).

    eud-change-label-text

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

    eud-change-label-text-1

The report is now ready. Switch your report to the Preview mode and view the result.

eud-change-label-text-2

results matching ""

    No results matching ""