Data Manipulation Functions

Applies To: Opalis 6.3

Opalis Integration Server enables you to manipulate string data from text files, Published Data items, or other sources, and convert it into a usable form. You can also perform arithmetic operations, such as calculating sums and differences, and performing division and multiplication operations. For example, you can extract text from a text file using a text file management object, trim leading and trailing spaces from the text, and then retrieve specific parts of the text that you can pass to other objects as Published Data items.

For a complete list of the functions that you can perform, see the Functions table.

To insert a data manipulation function

  • You can insert a data manipulation function into any field that allows you to type text. Data manipulation functions must be enclosed in square brackets ('[' and ']'). For example:

    [Upper(‘this will be inserted in upper case’)]

    When the object executes, the ‘this will be inserted in uppercase’ text in the example will be replaced with 'THIS WILL BE INSERTED IN UPPERCASE'.

Nested Functions

If you want to use a data manipulation function within another function, you do not need to enclose the nest function in square brackets. For example, to nest the Field function you would write:

[Field(Field('username=jsmith@abcompany.com','=',2),'@',1)]

Functions

Functions are case-sensitive. For example, Upper('Text') will be processed, but upper('Text') will not.

Function and Definition Usage Parameters Example

Upper - converts text to upper case.

Upper('Text')

Text - the text that is being converted to upper case.

Upper('this will be converted to uppercase') returns 'THIS WILL BE CONVERTED TO UPPERCASE'

Lower - converts text to lower case

Lower('Text')

Text - the text that is being converted to lower case.

Lower('This Will Be Converted To Lowercase') returns 'this will be converted to lowercase'

Field - returns text in a specific position

Field('Text', 'Delimiter', Field Number)

Text - the text that is being searched

Delimiter - the character that separates each field

Field Number - the position of the field that is being returned (starting at 1)

Field('John;Smith;9055552211', ';', 2) returns 'Smith'.

Sum - returns the sum of a set of numbers

Sum(firstNumber, secondNumber, thirdNumber, ...)

Number - the number being added, you can put any set of numbers each separated by a comma (,).

Sum(2,3,4,5) returns '14'

Diff - returns the difference of two numbers

Diff(Number1, Number2, <Precision>)

Number1 - the number that will be subtracted from

Number2 - the number that will be subtracted from Number1

Precision <Optional> - the number of decimal places that the result will be rounded to

Diff(9, 7) returns '2'

Diff(9.3, 2.1, 2) returns '7.20'

Mult - returns the product of a set of numbers

Mult(firstNumber, secondNumber, thirdNumber, ...)

Number - the number being multiplied, you can put any set of numbers each separated by a comma (,).

Mult(2, 3, 4) returns '24'

Div - returns the quotient of two numbers

Div(Number1, Number2, <Precision>)

Number1 - the number that will be divided

Number2 - the number that will divide Number1

Precision <Optional> - the number of decimal places that the result will be rounded to

Div(8, 4) returns '2'

Div(9, 2, 2) returns '4.50'

Instr - returns the position of first occurrence of text within another text

Instr ('SearchText', 'TextToFind')

SearchText - the text that is being searched

TextToFind - the text that you are searching for

Instr('This is a string that is searched', 'string') returns 11

Right - returns a subset of the text from the right side of the full text

Right('Text', Length)

Text - the full text

Length - the number of characters from the right side that will be returned

Right('Take from the right', 9) returns 'the right'

Left - returns a subset of the text from the left side of the full text

Left('Text', Length)

Text - the full text

Length - the number of characters from the left side that will be returned

Left('Take from the left', 4) returns 'Take'

Mid - returns a subset of the text from the middle of the full text

Mid('Text', Start, Length)

Text - the full text

Start - the starting position in the text where you want to begin returning characters

Length - the number of characters starting from the Start position that will be returned

Mid('Take from the middle', 5, 4) returns 'from'

LTrim - Trims leading spaces from text

LTrim('Text')

Text - the text being trimmed of leading spaces

LTrim(' Remove the leading spaces only. ') returns 'Remove the leading spaces only. '

RTrim - Trims the trailing spaces from text

RTrim('Text')

Text - the text being trimmed of trailing spaces

RTrim(' Remove the trailing spaces only. ') returns ' Remove the trailing spaces only.'

Trim - Trims leading and trailing spaces from text

Trim('Text')

Text - the text being trimmed

Trim(' Remove leading and trailing spaces. ') returns 'Remove leading and trailing spaces.'

Len - returns the length of text

Len('Text')

Text - the text that is being measured

Len('Measure this text') returns 17