Text - Get substring

Declaration

<AMTEXT ACTIVITY="get_substring" TEXT="text" RESULTVARIABLE="text" STARTPOSITION="number" LENGTH="number" />

Related Topics   

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 (i.e. %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.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

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.

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