Text - Get substring
Declaration
<AMTEXT ACTIVITY="get_substring" TEXT="text" RESULTVARIABLE="text" STARTPOSITION="number" LENGTH="number" />
Description
Retrieves a portion of the text specified and places the result in a variable.
Practical usage
Generally used as a text manipulation tool to retrieve specific text from a larger text value.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Original text | Text | Yes | (Empty) | TEXT="My name is Joe" | The target text to retrieve the subtext from. As with every text parameter, if the data you wish to enter is contained in a variable, simply enter the variable name surrounded by percentage signs to resolve it to it's contents at runtime (for example, %VarName%). |
Starting Position | Number | Yes | (Empty) | POSITION="24" | The position in the text in which retrieval should begin. |
Length of text to get | Number | No | (Empty) | LENGTH="3" | The number of characters to retrieve. |
Populate variable with result | Text | Yes | (Empty) | RESULTVARIABLE="varname" | The name of an existing variable to be populated with the new value. |
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
This sample task are gets a portion of a text string and populates a variable with results then displays the retrieved substring in a message box.
Copy
<AMVARIABLE NAME="theVar" VALUE="Hello" />
<AMTEXT ACTIVITY="get_substring" TEXT="%theVar%" RESULTVARIABLE="theVar" STARTPOSITION="1" LENGTH="2" />
<AMSHOWDIALOG>The sub text retrieved was %theVar%</AMSHOWDIALOG>