Text - Trim

Declaration

<AMTEXT ACTIVITY="trim" TEXT="text" RESULTVARIABLE="Text" ACTION="text (options)" CHARACTERS="text" ORDERED="Yes/No" />

Related Topics   

Description

Trims characters from the beginning and/or end of a text string and populates a variable with results.

Practical usage

Text manipulation. Used to take spaces off of the beginning or end of a text value. These spaces can sometimes be caused by data-entry error or a formatting routines from external applications.

Parameters

General

Property Type Required Default Markup Description
Text to remove from Text Yes (Empty) TEXT="My Name is Joe" The target text to be trimmed. 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%).
Remove from Text (options) No beginning and end
  • ACTION="remove_beginning_and_ end"
  • ACTION="remove_beginning"
  • ACTION="remove_end"
Specifies where the text is trimmed. The available options are:
  • Beginning and end (default) - Text is stripped from the beginning and end of the target text.
  • Beginning - Text is stripped from the beginning of the target text.
  • End -Text is stripped from the end of the target text.
Remove Text (options) No Whitespace
  • REMOVE="whitespace"
  • REMOVE="returns"
  • REMOVE="spaces"
  • REMOVE="tabs"
  • REMOVE="user"
The characters to remove from the string. The available options are:
  • Whitespace (default) - All whitespace characters will be removed from the string.
  • Carriage returns - Carriage returns will be removed from the string
  • Spaces - Spaces will be removed from the string
  • Tabs - Tabs will be removed from the string
  • User defined - The text entered in the Characters to Remove parameter will be removed from the string.
Characters to remove Text Yes, if Remove is set to User defined (Empty) CHARACTERS="x" The user defined characters to remove. This parameter is active only if the Remove parameter is set to User defined.
Characters can be in any order Yes/No No No ORDERED="NO" If set YES, characters to be removed can be in any order. If disabled, characters to be removed must be in the order entered.
Populate variable with result Text Yes (Empty) RESULTVARIABLE="varname" The name of the variable to receive the new formatted text value.

Description

Error Causes

On Error

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

A simple task that demonstrates the use of Text - Trim activity.

Copy
<AMVARIABLE NAME="theVar" VALUE="|Hello World|" />
<AMSHOWDIALOG>The text before Trim Text action: %theVar%</AMSHOWDIALOG>
<AMTEXT ACTIVITY="trim" TEXT="%theVar%" RESULTVARIABLE="theVar" REMOVE="user" CHARACTERS="|" />
<AMSHOWDIALOG>The text after Trim Text action: %theVar%</AMSHOWDIALOG>