Application icon

Truncate

This statement is designed to truncate the contents of a track or named variable if it is greater than a specified number of characters. You can elect to truncate the start or end of the field if it exceeds the specified length.

You can optionally replace the removed text with the contents of the replace field.

The supplied text fields may contain any of the escape sequences described in Escape Sequences. Note that the length field is only validated at run time.

Note that you cannot use this statement to completely remove the contents of a variable. If the length field evaluates to zero, the statement is ignored. See Filename Lengths for additional information.

The Consider length of Replace text when truncating option adjusts the final length by considering the text being inserted. For example if you truncate to 100 characters and replace the truncated characters with ..., the text will be truncated to 97 characters so that the final length is 100 when the ... is inserted. When this option is enabled, the statement will not truncate if the adjustment causes all characters in the initial value to be ignored.

For historic reasons, a negative length will be negated. eg. -5 will be treated as 5.

When truncating a named variable and executing stepwise, the statement is only executed once.

The action test state will be set to true if any changes were made. The test state will be set to false if no changes were made.