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 (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

Error Causes

On Error

NOTE: 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%" />