Conditionally Format Report Items

Controls and bands can be configured to change their appearance based upon a value. There are a few different ways you may choose to have your item's appearance modified:

Set an Item to be Not Visible if there is No Value

You may choose to have a band or control not appear in the report if there is no data to populate it. For example, if you have a sub-report control that, at runtime, does not become populated with data, you may set the control to not be visible so that there is less blank space in the report.

The IsNullorEmpty function indicates whether the specified String object is a null reference or an empty string. If the string is null or empty, the value returned is True. Otherwise, False is returned. This expression can be used to evaluate whether a field from the data source is empty. When this function is implemented in the Visible property, it can be used to determine the visibility of the item. All controls and bands have a Visible property, so this procedure can be used for any report item.

See Also...

To set an item to be not visible if there is no value

  1. Select the report item.

  2. Open the Expressions panel and then open the Expression Editor for Visible.

  3. Start typing IsN.

  4. Use the arrow keys to highlight IsNullOrEmpty from the dropdown list of functions.

  5. Press the Tab key.

    The expression auto populates with the correct syntax for the function and the cursor is blinking between the two brackets.

  6. Click Fields, and then expand the data source.

  7. Double-click the field that is to be evaluated for being null or empty.

    The field is inserted between the round brackets in the IsNullOrEmpty() function. Your expression should look similar to the following:

    IsNullOrEmpty([DataSourceName.FieldName])

  8. Click OK.

Set a Label Control to Display a Message if there is no Value

If a control is not populated by data at runtime, it may be helpful to show a confirmation message so users know the report is functioning as intended.

This procedure assumes that you have already configured a label control to populate with data from a field.

See Also...

Label Control

To set a message if there is no value to populate a label control

  1. Select the label control for which you want to have a null value confirmation message.

  2. Open the Properties panel.

  3. Open the Data property group.

  4. In the Null Value Text property, enter the message you wish to appear when there is no data to populate the control. For example, No data available.

    When there is a null value for the field, the control will now display your configured message.

Set an Item to Change its Appearance Based on a Value

Each band and control has a set of Appearance properties that can change the way it looks.

The Iif function can be used to evaluate a condition and then return a specified value based on whether the condition evaluates to true or false. The Iif function can be used in any of the appearance properties to change the appearance of a report item given a condition.

See Also...

To set an item to change its appearance based on a value

The following example sets the background color of a control based on the field value.

Step 1: Create the report

  1. In VertiGIS Studio Report Designer, click File and then New.

  2. From the list of options, double-click Layer Report.

  3. In the Layer Report Wizard, select Use a new ArcGIS layer or table and then click Next.

  4. Enter a name for the data source, such as LA County Service.

  5. For the URL, enter https://dmags3.geocortex.com/arcgis/rest/services/LosAngeles/LA_Layers/MapServer, and then click Next.

  6. Select Tax Parcels and then click Finish.

Step 2: Configure the Iif() expression

  1. Select the [OBJECTID] label control.

  2. Open the Expressions panel.

  3. Expand the Appearance property group.

  4. In the Background Color property, enter Iif([OBJECTID]=1,'#e01010' ,'' ).

    OBJECTID=1 is the condition. '#e01010' is the value that is output if the condition evaluates to true. In this case, the background is set to the colour red if the OBJECTID is 1.'' is the value that is output if the condition evaluates to false. In this case, the background color is blank if the OBJECTID is not 1.

  5. Open the report preview and for the FeatureIds, enter the values 1 2 3 4 5.

    The preview opens and the control with the OBJECTID of 1 is colored red.