Functions
Functions

Functions

image

A function takes zero or more parameters, performs some calculation, and then returns a single value.

A wide range of functions are available to help you perform different tasks – these are listed in the table below.

In addition, two specific functions, Data(name) and System(name) are also available, which return source table data and system metadata respectively — these are described [page here]

Eightwire is generally case-insensitive. This means that you can write your expressions in uppercase, lowercase, or any combination, provided you spell things correctly.

When providing function parameters for comparison/searching type activities, these will work no matter what their case, provided they are otherwise an exact match – pay attention to any spaces or other punctuation, these count when searching or comparing things.

image

String Manipulation

PropertyExpressionDescription
String
Find(value, before, after)
Return the text in value between before and after. For example, the following expression returns " quick ": Find("The quick brown fox","The ", "Brown")
String
First(value, length)
Return the first length characters from value. For example, the following expression returns "The qui": First("The quick brown fox", 7)
String
Last(value, length)
Returns the last length characters from value. For example, the following expression returns "own fox": Last("The quick brown fox", 7)
String
FirstFilled(value [,.., value])
Returns the first value parameter that is not empty, not null and not encoded-null (chr(0)). This function takes one or more parameters. The left-most parameter is checked first, then the next, and so on, until one is found that is not blank and this value is returned. If no non-blank parameters are found, an empty string is returned (""). For example, the following expression returns "fox": FirstFilled("", "", "", "Fox", "")
String
Lowercase(value)
Returns value as lowercase text. For example, the following expression returns "brown fox": Lowercase("Brown Fox")
String
IndexOf(value, find)
Returns the left-most character index of find within value. If find does not occur as a substring of value then -1 is returned. Character indexes are 0-based. For example, the following expression returns 1: IndexOf("Fog Dog Log", "og")
String
LastIndexOf(value, find)
Returns the right-most character index of find within value. If find does not occur as a substring of value then -1 is returned. Character indexes are 0-based. For example, the following expression returns 9: LastIndexOf("Fog Dog Log", "og")
String
PadLeft(value, length) PadLeft(value, length, padding)
Returns value, right-aligned, padded with the padding character, resulting in text length characters long. If padding is not provided, the result will be padded with whitespace. For example, the following expression returns "--Fox": PadLeft("Fox", 5, "-")
String
PadRight(value, length) PadRight(value, length, padding)
Returns value, left-aligned, padded with the padding character, resulting in text length characters long. If padding is not provided, the result will be padded with whitespace. For example, the following expression returns "Fox--": PadRight("Fox", 5, "-")
String
Replace(value, find, replace)
Finds all occurrences of find in value and replaces them with replace, returning the resulting text. For example, the following expression returns "The slow fox": Replace("The quick fox", "quick", "slow")
String
SubString(value, start) SubString(value, start, length)
Returns length characters in value, starting from character position start, which is 0-based. If length is not provided, the remainder of the text is returned after start. For example, the following expression returns "ui": SubString("The quick fox", 5, 2)
String
Token(value, index) Token(value, index, separator)
Splits value into multiple tokens, using the separator character (or whitespace if not provided), then returns the index token (0-based). For example, the following expression returns "brown": Token("The quick brown fox", 2)
String
FirstToken(value) FirstToken(value, separator)
Splits value into multiple tokens, using the separator character (or whitespace if not provided), then returns the first (left-most) token. For example, the following expression returns "The": FirstToken("The quick brown fox")
String
LastToken(value) LastToken(value, separator)
Splits value into multiple tokens, using the separator character (or whitespace if not provided), then returns the last (right-most) token. For example, the following expression returns "fox": LastToken("The quick brown fox")
String
Trim(value)
Returns value with any leading and trailing whitespace removed. For example, the following expression returns "fox": Trim(" fox ")
String
TrimLeft(value)
Returns value with any leading whitespace removed. For example, the following expression returns "fox ": TrimLeft(" fox ")
String
TrimRight(value)
Returns value with any trailing whitespace removed. For example, the following expression returns "fox": TrimRight(" fox ")
String
Uppercase(value)
Returns value as uppercase text. For example, the following expression returns "BROWN FOX": Uppercase("Brown Fox")

Number Manipulation

PropertyExpressionDescription
Number
Number
Number

Date & Time Manipulation

PropertyExpressionDescription
Date & Time
Date & Time

Conversions

PropertyExpressionDescription
Conversions
Conversions
Conversions
Conversions
Conversions
Conversions
Conversions
Conversions
Conversions

Validation

PropertyExpressionDescription
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation
Validation

Formatting

PropertyExpressionDescription
Formatting
Formatting
Formatting
Formatting
Formatting

Miscellaneous

PropertyExpressionDescription
Miscellaneous
Length(value)
Converts value into text and returns the number of characters it contains, including whitespace. For example, the following expression returns 19: Length("The Quick Brown Fox")

Special

PropertyExpressionDescription
Special
Special
Special