Maintaining Display Conditions for an Agency View Field

In this Topic

  1. Entering Field and Label Conditions
    1. Color
    2. Bold and Visible
    3. Value
    4. Check Box/Boolean Fields
  2. Example Calculations

The Agency View Detail Conditions Summary enables you to apply formatting to field values and labels in an agency view when you want to draw attention to certain fields or data conditions. For field values, you can determine whether the value is visible, displayed in bold text, or displayed in a specific text color. For field labels, you can determine the text of the label, and whether the label is visible or displayed in a specific text color. You can configure these attributes to vary based on the result of a calculation. For example, you can specify that if a field value is greater than or equal to 50, the value will display in red text, and if the value is less than 50, it will display in green text.

To apply conditional formatting to an agency view field, navigate to the summary for the parent control (either a list, detail, or accordion), locate the row for the appropriate field, and then select Conditions from the Actions menu on the field row. The system takes you to the Agency View Detail Conditions Summary for the selected field.

Entering Field and Label Conditions

In the Field Conditions section, you can enter an Expression in the appropriate row to indicate display settings for Bold, Color, and Visible for the field value. In the Label Conditions section, you can enter an Expression in the appropriate row to indicate display settings for Color, Value, and Visible for the field label. Expressions must be entered using standard python commands and syntax (see Supported IronPython Functions).

Color

To indicate color, you can enter either the browser-supported color name or the hex value of the color in single quotes. For example, you can enter 'Green' or 'DarkRed' or '#1FB4DA' in the Expression field for Color in either the Field Conditions or Label Conditions section, as appropriate. Not all color names are supported. For a list of all supported color names, see Color Names Supported for Agency Views.

Bold and Visible

The Bold and Visible attributes are modified by using True or False. For example, to hide a field or field label, enter False in the Expression field for Visible in either the Field Conditions or Label Conditions sections, as appropriate. True or False must be entered without quotes and with the first letter capitalized.

Value

To indicate the value of a field label, enter the label text in single quotes. For example, you can enter 'Overrun' in the Expression field for Value in the Label Conditions section.

Check Box/Boolean Fields

When setting conditions for a check box/boolean field, the values available for evaluation are: None (as the field appears when a view is first opened, before interaction); '' for false; and on for true. Note that the value for false is two single quotes rather than one double quote.

When you are finished making changes, click the Save button. To test your changes, navigate back to the Agency View Summary and select Preview Agency View from the Actions menu on the component header. Make sure the display settings appear as you intended and adjust them as needed.

Example Calculations

To display conditional formatting based on the result of a calculation, you can enter the calculation and the desired result in the Expressions field in standard Python syntax. Conditional statements that include if must also include else.

Expressions can include field names formatted as Entity.FieldName. If the condition is based on an agency entity rather than a system entity (as indicated by a value in the Agency Entity ID field rather than the Entity ID field on the Agency View Summary), you can specify a field from the agency entity's parent by formatting the field name as ParentEntity.FieldName.

Calculations can include the following mathematical operators:  

 +    -    /    *    ^    ==    !=    <>    <    <=    >    >=    (    )

For example, you can use a calculation to change the color of a field label based on the value of another field in the same entity. In the Expression field for Color under Label Conditions, entering the following text causes the field label to be displayed in green text if the value in the Quantity field is greater than 50, and red text if the quantity is 50 or less:

'Green' if Entity.Quantity > 50 else 'Red'

When using numeric values with the operators == and !=, the numeric value must be in the exact precision for the given field. For example, if trying to use the following conditional statement: True if Entity.Length != 0 else False,  the field's precision is 10,2 so the statement must be re-written as: True if Entity.Length != 0.00 else False because a 0 entered will become 0.00 after the user tabs out of the field.

For a simple condition that evaluates as either true or false, such as for Visible or Bold, you can enter the following text in the Expression field to apply the setting to the field when the Quantity is 100:

Entity.Quantity == 100

You can also create expressions that rely on multiple fields. If the following example is entered in the Expression field for Value under Label Conditions, it causes the field label to change from Over to Under, depending on the value of two other fields:

'Over' if Entity.Field1 >= 10 and Entity.Field2 >= 10 else 'Under'

Similarly, you could join the two field requirements with or, so that a value greater than or equal to 10 in either field causes the label change.

For conditional statements that depend on check box/boolean fields, the negative case should be written as follows:  

Entity.CheckBox in ['', 'False']

For example, when trying to hide Field1 when a check box Field2 is not checked, Field1 would have a conditional statement in the Visible type field condition written as follows:

Entity.Field2 in ['', 'False']

For conditional statements that depend on check box/boolean fields, the positive case should be written as follows:

Entity.CheckBox in ['on', 'True']

For example, when trying to display Field1 when a check box Field2 is checked, Field1 would have a conditional statement in the Visible type field condition written as follows:

Entity.Field2 in ['on', 'True']

Because auto-complete controls are used with fields that store a system generated ID, comparisons between auto-complete fields are limited to one field being equal to or not equal to the other field. If the following example is entered in the Expression field for Color under Label Conditions, it causes the field label to be displayed in red text if the selected vendor is not the prime vendor for the contract, and gray text if the selected vendor is the prime vendor.

'Red' if Entity.Vendor != ParentEntity.PrimeRefVendorId else 'Gray'

When you are finished making changes, click the Save button. To test your changes, navigate back to the Agency View Summary and select Preview Agency View from the Actions menu on the component header. Make sure the display settings appear as you intended and adjust them as needed.

Related topics:

Maintaining an Agency View

Maintaining an Accordion for an Agency View

Maintaining a List for an Agency View

Maintaining a Details Area for an Agency View

 

Blue bar indicating the end of the topic