Text - Insert
Declaration
<AMTEXT ACTIVITY="insert" INSERTTEXT="text" TARGETTEXT="text" RESULTVARIABLE="sdf" ACTION="text (options)" POSITION="number" />
Overview
Inserts a specified string of text into the beginning, end, or precise position of an existing text value and populates a variable with the combined text contents.
Practical usage
Used as a text manipulation tool to insert new text into an existing text value.
Parameters
TEXT=My name is Joe.
General
| Property | Type | Required | Default | Markup | Description |
|---|---|---|---|---|---|
| Text to insert into | Text | Yes | (Empty) | TARGETTEXT="Smith" | The target text to insert characters. As with every text parameter, if the data you want to insert is contained in a variable, enter the variable name surrounded by percent signs (%) (for example, %VarName%) to resolve it to its contents at runtime. |
| Action to take | Text (options) | No | insert_beginning | ACTION="insert_end" | Indicates the location
in the target text to insert characters into.
The available options are:
|
| Position to insert text | Number | No | (Empty) | POSITION="3" | The position in the text to perform the insert. This parameter is available only if the Action to take parameter is set to Insert at position. |
| Characters to be inserted | Text | Yes | (Empty) | INSERTTEXT="Hello" | The characters that should be inserted. |
| Populate variable with result | Text | Yes | (Empty) | RESULTVARIABLE="varname" | The name of an existing variable to populate with the new value after character insertion is performed. |
Example
NOTE:
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
The following sample task displays a message, showing the value of a variable before and after a Text - Insert activity is used.
Copy
<AMVARIABLE NAME="theTargetText" VALUE="Hello"></AMVARIABLE>
<AMSHOWDIALOG>The value before character insertion is '%theTargetText%'.</AMSHOWDIALOG>
<AMTEXT ACTIVITY="insert" INSERTTEXT="World" TARGETTEXT="%theTargetText%" RESULTVARIABLE="theTargetText" ACTION="insert_end" />
<AMSHOWDIALOG>The new value after character insertion is '%theTargetText%'.</AMSHOWDIALOG>