Trim Text Action Icon

Trim Text

Declaration

<AMTEXTREMOVE TEXT="text" REMOVE="text" CHARACTERS="text" ACTION="text [options]" RESULTVARIABLE="text [varibable name]">

See Also

Convert Case | Find Text | Format Date/Time | Get Subtext | Insert Text | Pad Text | Replace Text | Trim Text

Description

Removes characters from the beginning and/or end of the specified text and places the result in a variable..

Practical Usage

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

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Text to remove from

Text

Yes

(Empty)

 

TEXT="My Name is Joe"

The target text to be trimmed.

Remove from

Text (options)

No

beginning and end

ACTION="remove_end"

Specifies where the text is trimmed. The available options are:

  • beginning and end: The text is stripped from the beginning and end of the target text.

  • beginning: The text is stripped from the beginning of the target text.

  • from end: The text is stripped from the end of the target text.

Remove

Text (options)

No

Whitespace

REMOVE="returns"

The character(s) to remove from the string. The available options are:

  • Whitespace: All whitespace characters are removed from the string

  • Carriage returns: Carriage returns are removed from the string

  • Spaces: Spaces are removed from the string

  • Tabs: Tabs are removed from the string

  • User defined: The text entered in the Characters to Remove parameter are removed from the string.

Characters to remove

Text

Yes if Remove parameter is 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.

Populate variable with result

Text

Yes

(Empty)

RESULTVARIABLE="varname"

The name of the variable to receive the new formatted text value.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: Simple task that demonstrates the use of Trim Text action.

 

<AMVARIABLE NAME="theVar">|Hello World|</AMVARIABLE>

<AMSHOWDIALOG MESSAGE="The text before Trim Text action: %theVar%" />

<AMTEXTREMOVE REMOVE="user" CHARACTERS="|" TEXT="%theVar%" RESULTVARIABLE="theVar" />

<AMSHOWDIALOG MESSAGE="The text after Trim Text action: %theVar%" />

 

↑ Top of Page