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.

General Parameters

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 (e.g., %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.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: This sample task uses a Get substring activity to get part of the text string populated into a variable and displays the retrieved substring in a message box.

<AMVARIABLE NAME="theVar">Hello</AMVARIABLE>
<AMTEXTGETSUBTEXT TEXT="%theVar%" 
STARTPOSITION="1" LENGTH="2" RESULTVARIABLE="theVar" />
<AMSHOWDIALOG MESSAGE="The sub text retrieved was %theVar%" />