Building Text Expressions

The Text Expression dialog box is available in several places in Infrastructure Studio. Use it to specify URL, tooltip, and feature label values. For example, you might create a text expression that specifies the following label text:

<State_Name>: <Population>

Where <State_Name> and <Population> are the values of these properties for each feature. For example, California: 33,871,648.

The Text Expression dialog box has two modes: Builder and Advanced. In Builder mode you can only create expressions that use valid syntax. In Advanced mode you can create expressions using any syntax, even if it is not handled by the Builder. You cannot move from Advanced mode to Builder mode unless conditions are valid. Further, an expression with valid syntax is not allowed in the builder if it contains functions or property names that are not in the layer’s data source.

To build a text expression

  1. In the Text Expression dialog box, under Text Value, do any of the following:
    • Click Property and select a property from the list.
    • Click Constant and enter the text to use.
    • Click Number Expression and click […]. Use the Number Expression dialog box to create a number expression.

      For more information, see Building Number Expressions.

  2. To add components to the expression, click New and define the next component.

    To join multiple components in Advanced mode, use concat. For example:

    concat(State_Name, concat(‘: ‘,Population))

    Spaces are ignored in Advanced mode except within the single quotes that specify a constant.

  3. Click OK.
  4. Click File menu Save.

Building URL Expressions

The following functions are designed to help build URL expressions that include identifying information with each feature. For example, when you click on a feature, the link opens a browser window that displays the feature's properties.

Function Description
MAPNAME() Name of the runtime map for the current session
SESSION() Current session ID
LAYERID() Layer ID of the feature associated with the URL
FEATURECLASS() Class name of the feature associated with the URL
FEATUREID() ID of the feature associated with the URL
URLENCODE(string) URL-encodes the supplied string

To create this type of expression, you must use the Text Expression dialog box in Advanced Mode. For the above mentioned use case, the following expression is an example of a feature URL that includes the necessary identifying information:

concat(concat(
concat('Hyperlink.php?FeatureID=', URLENCODE(FEATUREID())),
concat('&FeatureClass=', URLENCODE(FEATURECLASS()))),
concat('&LayerID=', URLENCODE(LAYERID())))
Note:

When using these functions in feature URL expressions, remember to use URLENCODE to ensure that all URL parameter values are properly encoded.