Geocortex Reporting Help
Open topic with navigation
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:
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.
To set an item to be not visible if there is no value
Select the report item.
Open the Expressions panel and then open the Expression Editor for Visible.
Use the arrow keys to highlight IsNullOrEmpty from the dropdown list of functions.
Press the Tab key.
The expression auto populates with the correct syntax for the function and the cursor is blinking between the two brackets.
Click Fields, and then expand the data source.
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:
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.
To set a message if there is no value to populate a label control
Select the label control for which you want to have a null value confirmation message.
Open the Properties panel.
Open the Data property group.
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.
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.
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
In Geocortex Report Designer, click File and then New.
From the list of options, double-click Layer Report.
In the Layer Report Wizard, select Use a new ArcGIS layer or table and then click Next.
Enter a name for the data source, such as
LA County Service.
For the URL, enter
https://dmags3.geocortex.com/arcgis/rest/services/LosAngeles/LA_Layers/MapServer, and then click Next.
Select Tax Parcels and then click Finish.
Step 2: Configure the Iif() expression
Select the [OBJECTID] label control.
Open the Expressions panel.
Expand the Appearance property group.
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.
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.