Altair® Panopticon

 

Text Calculations

Text calculations allow new text columns to be created based on input string manipulation.

They typically use one or more of the following operators:

Function

Description

CONCAT

Concatenates two strings together.

DEC2HEX

Converts a decimal number to hexadecimal.

Example: DEC2HEX(255, 2) = "FF"

FIND

Returns the starting position of a text string within another text string.

IFTEXT

Returns a string based on the expression being evaluated to true or false.

LEFT

Returns the left most characters from a string producing a new string.

LEN

Returns the number of characters in a string.

LOWER

Returns the input string in lower case.

MID

Returns the characters from the middle of a text string, given a starting position and length.

PROPER

Converts a text string to proper case; the first letter in each word in uppercase, and all other letters in lower case.

REPLACE_ALL

Replaces all of the instances of the pattern_to_replace with the replacement_text.

For example:

replace_All(input_text, pattern_to_replace, replacement_text)

replace_All("ABA", "A", "X") = "XBX"

NOTE: Only input_text may be null.

Special cases:

·         If input_text is null, the result is null.

If pattern_to_replace is empty, it's considered to occur at every position in the input_text (including before the first and after the last character).

REPLACE_FIRST

Replaces the first instance of the pattern_to_replace with the replacement_text.

For example:

Replace_First(input_text, pattern_to_replace, replacement_text)

Replace_First("ABA", "A", "X") = "XBA"

Note: Only input_text may be null.

Special cases:

·         If input_text is null, the result is null.

If pattern_to_replace is empty, it's considered to occur at every position in the input_text (including before the first and after the last character).

RIGHT

Returns the right most characters from a string producing a new string.

TRIM

Returns the input string stripped of leading or following spaces.

UPPER

Returns the input string in upper case.

 

In addition, the IF calculation can be used on text inputs to define the condition, to produce numeric output.

Example: IF([SIDE]=”BUY”,[SIZE],-[SIZE])

Calculation Data Type

The data type of a calculation will default to text if a text column is used in the calculation.  This type can be set manually by checking the “Set type manually” checkbox.

And then picking the appropriate output data type.