Concatenating information

The CONCAT action and the PREFIX action provide two actions for concatenating information in a rule set.

CONCAT action

CONCAT concatenates information to a user variable or a dictionary column. The source can be an operand, literal, or user variable. For example, fractions, such as ½ and ¼, can be copied to a single column in the dictionary by using the following pattern action set:


^ | / | ^
COPY [1] temp
CONCAT [2] temp
CONCAT [3] temp
COPY temp {Fractions}

The {Fractions} column contains the entire fraction (½).

User variables are most often used with the CONCAT action to form one field. If you want to copy two directions with spaces (for example: EAST WEST) into a single dictionary column, you create the following actions:


D =T= "EAST"| D =T= "WEST" | T
COPY [1] temp
CONCAT " " temp
CONCAT [2] temp
COPY temp {StreetName}

This pattern tests for the specific directions EAST and WEST. The first operand is copied to the user variable temp. The contents of temp is now EAST. The next line concatenates a space to the variable temp. The second CONCAT appends WEST to the variable temp. The variable now contains EAST WEST. Then, the contents of temp are copied to the street name field.

Note: A literal with a single space is concatenated to the variable. The same results cannot be obtained by concatenating directly into the dictionary column. Dictionary columns are null at the time of initialization. Adding a space does not change the contents of the column and does not alter future actions.

CONCAT permits substring ranges. For example:


CONCAT [1](3:-2) {StreetName}

From position 3 to the second to last position of the first operand is concatenated to the street name column of the dictionary column.

CONCAT_A concatenates the standard abbreviation instead of the original token data. The source can only be an operand. CONCAT_A allows substring ranges. However, the substring refers to the standard abbreviation and not the original token.

CONCAT_I concatenates the initials instead of the original token data. You can use CONCAT_I as a POST action where the source must be a dictionary column and the target must be a dictionary column.

CONCAT_I, when not used as a POST action, allows substring ranges with the substring referring to the initials and not the original token. In most cases, there is a single initial, but for multi-token strings, such as John Henry Smith, the initials are JHS, and substring ranges other than (1:1) make sense.

Learn more the CONCAT action and spaces: When the source is a user variable, the CONCAT action preserves the spaces within the token. When the source is an operand, the CONCAT action does not preserve spaces within the token.

CONCAT does not provide the ability to preserve spaces between tokens matching up to either ? or ** in a pattern statement (such as the COPY_S action). To preserve spaces between tokens, you must use the COPY_S action to copy the tokens to a user variable and prefixing or concatenating that user variable. To pick up attention text in an input line, refer to the following examples:

Table 1. Examples of how to copy tokens into user variables
Lines within one pattern action set Description
+="SEE" | ** ; grab "SEE JOHN DOE"
COPY [1] temp ; put "SEE" in user variable temp
CONCAT " " temp ; add a space to the end of user variable temp
COPY_S [2] temp2 ; put "JOHN DOE" (including space) in temp2
CONCAT temp2 temp ; concat temp2 onto temp
COPY temp {AdditionalNameInformation} ; put "SEE JOHN DOE" into column AdditionalNameInformation

PREFIX action

The PREFIX action adds data to the beginning of a string. The source for PREFIX can be an operand, a literal, or a user variable. The target can be a user variable or a dictionary column.


COPY "CHARLES" temp
PREFIX "SAINT" temp

In the preceding example, the variable temp contains SAINTCHARLES.

PREFIX permits substring ranges. For example in the following sample:


PREFIX [1](3:-2) {StreetName}

From position 3 to the second to last position of the first operand is prefixed to the street name column.

PREFIX_A prefixes the standard abbreviation instead of the original token data. The source must be an operand. PREFIX_A allows substring ranges; however, the substring refers to the standard abbreviation and not the original token.

PREFIX_I prefixes the initials instead of the original token data. You can use PREFIX_I as a POST action where the source must be a dictionary column and the target must be a dictionary column.

PREFIX_I, when not used as a POST action, allows substring ranges with the substring referring to the initials and not the original token. In most cases, there is a single initial, but for multi-token strings, such as John Henry Smith, the initials are JHS, and substring ranges other than (1:1) make sense.

Learn more the PREFIX action and spaces: When the source is a user variable, the PREFIX action preserves the spaces within the token. When the source is an operand, the PREFIX action does not preserve spaces within the token.

PREFIX does not let you preserve spaces between tokens matching up to either ? or ** in a pattern statement such as the COPY_S action. To preserve spaces between tokens, you must use COPY_S to copy the tokens to a user variable and the prefix or concatenate that user variable. Refer to the preceding pattern-action set example.