Insert Text

The Insert Text data prep function allows you to insert a constant character string into a text field. This function is useful when, for example, updating data in a column to reflect series (e.g., Employee ID 12345 becomes Employee ID 12345-2020) or categories (e.g., Auditor becomes Auditor-Internal or Auditor-External).

Description

Inserts specified string at the specified position in a text field.

When you apply this operation, you are first asked to enter the string to insert into the field:

 

Then, you must define where in the field to insert the specified string:

 

  • Index - Inserts the string at a specific point (index) beginning from the left of the values in the field. When this option is selected, an index (Index, i.e., number of places starting from the left of the field) must also be specified. For example, if the field contains the value ABCDEF, and you choose to insert the string -2000- by specifying "Insert at Index" and indicating an index value of 2, the resulting field value will read A-2000-BCDEF. Note that if the specified index is greater than the value’s length, the text will be inserted at the end of the value string.

  •  

  • Start - Inserts the specified string at the beginning of the all values in the field

  • End - Inserts the specified string at the end of all values in the field

  • Before Text - Inserts the string before a specified text string (Before Text). When this option is selected, you may also indicate at which occurrence (Rule, i.e., first, last, all) of the specified string to insert text into. For example, if the field contains the value AB+CD+EF, and you choose to insert the string -2000- by specifying "Insert Before Text," "Before Text +," and "Rule First Occurrence," the resulting field value will read AB-2000-+CD+EF.

  •  

  • After Text - Inserts the string after a specified text string (After Text). When this option is selected, you may also indicate at which occurrence (Rule, i.e., first, last, all) of the specified string to insert text into. For example, if the field contains the value AB+CD+EF, and you choose to insert the string -2000- by specifying "Insert After Text," "After Text +," and "Rule Last Occurrence," the resulting field value will read AB+CD+-2000-EF.

  •  

  • Before Type - Inserts the string before a specified character type (Character Type, i.e., alpha, numeric, other printable characters/symbols). When this option is selected, you may also indicate at which occurrence (Rule, i.e., first, last, all) of the specified character to insert text into. For example, if the field contains the value ABC1DEF2, and you choose to insert the string -2000- by specifying "Insert Before Type," "Character Type Numeric," and "Rule All Occurrences," the resulting field value will read ABC-2000-1DEF-2000-2.

  •  

  • After Type - Inserts the string after a specified character type (Character Type, i.e., alpha, numeric, other printable characters/symbols). When this option is selected, you may also indicate at which occurrence (Rule, i.e., first, last, all) of the specified character to insert text into. For example, if the field contains the value ABC1DEF2, and you choose to insert the string -2000- by specifying "Insert After Type," "Character Type Alpha," and "Rule First Occurrence," the resulting field value will read A-2000-BC1DEF2.

  •  

 

Input/Output Data Type

Input

text

Output

text

Example

In this example, the first column (EMP_ID) is the original column. The text string -2020 is added to the End all of rows in the second column (EMP_ID_I).

 

 

 

© 2024 Altair Engineering Inc. All Rights Reserved.

Intellectual Property Rights Notice | Technical Support