User Community Service Desk Downloads
If you can't find the product or version you're looking for, visit support.ataccama.com/downloads

Commonly Used Functions

ONE Desktop uses a powerful rule language that includes a set of built-in functions for most common data transformations and algorithms in the data quality realm. The language is designed to be welcoming to newcomers with heterogeneous backgrounds and can be easily extended.

See also ONE Expressions.

Basic string functions

Function Description

left(srcStr, count)

Returns a new string that is a substring of srcStr containing count of characters taken from the start of the srcStr.

right(srcStr, count)

Returns a new string that is a substring of srcStr containing count of characters taken from the end of the srcStr.

substr(srcStr, beginIndex), substr(srcStr, beginIndex, strLen)

Returns a new string that is a substring of the string srcStr.

transliterate(srcStr, charsFrom, charsTo)

Transforms characters of the string srcStr.

containsWord(srcStr, srcWord)

Searches for the occurrence of the word srcWord in the string srcStr.

indexOf(srcStr, subStr), indexOf(srcStr, subStr, fromIndex)

Returns the index within the string srcStr of the first occurrence of the specified substring subStr.

lower(srcStr)

Transforms all characters of the string srcStr to lower case.

upper(srcStr)

Transforms all characters of the string srcStr to upper case.

capitalize(srcStr)

Transforms the first character of each word to upper case and all following characters to lower case.

replicate(srcStr, n)

Returns n copies of the string srcStr concatenated together without any separator.

replace(srcStr, what, withWhat)

Replaces occurrences of the string what with the string withWhat in the string srcStr.

Regular expression functions

Function Description

find(srcRegex, srcStr [, caseInsensitive])

Verifies whether the string srcStr or its parts match the regular expression srcRegex.

matches(srcRegex, srcStr [, caseInsensitive])

Verifies whether the string srcStr matches exactly the pattern of the regular expression srcRegex.

substituteAll(srcPattern, srcReplacement, srcStr [, caseInsensitiveFlag])

Replaces all occurrences of srcPattern in string srcStr with srcReplacement.

substituteMany(srcPattern, srcReplacement, srcStr, srcVolume [, caseInsensitiveFlag])

Replaces all occurrences of srcPattern in the string srcStr with srcReplacement, the maximum number of replacements is defined by the parameter srcVolume.

Conversion functions

Function Description

toDate(expr, dateFormat[, dateLocale])

Returns the date specified in expression expr converted to date type DAY.

toString(expr, strFormat[, strLocale])

Converts the expression expr to a STRING value.

Datetime functions

Function Description

datePart(srcDate, fieldName)

This function returns the value of the field fieldName (YEAR, MONTH, or DAY) of the srcDate.

dateDiff(startDate, endDate, fieldName)

Returns the difference between the endDate and startDate expressed in fieldName units.

today()

Returns the current date in type DAY.

dateAdd(srcDate, srcValue, fieldName)

Adds the specified srcValue of the type specified by fieldName (YEAR, MONTH, or DAY) to the srcDate.

String distance functions

Function Description

hamming(srcStr1, srcStr2 [, caseInsensitive])

Returns the Hamming distance between the strings srcStr1 and srcStr2.

levenshtein(srcStr1, srcStr2 [, maxDistance][, caseInsensitive])

Returns the Levenshtein distance between the strings srcStr1 and srcStr2.

editDistance(srcStr1, srcStr2 [, maxDistance] [, caseInsensitive])

Returns the edit distance between the strings srcStr1 and srcStr2.

soundex(srcStr)

Returns the soundex value of the srcStr parameter.

doubleMetaphone(srcStr), doubleMetaphone(srcStr, isAlternate)

Encodes srcStr to a double metaphone primary string. Encodes srcStr to a double metaphone secondary string if the parameter isAlternate is true.

Set distance functions

Function Description

intersection(set1, set2, separator [, multiset])

Returns the cardinality of the intersection of sets.

difference(set1, set2, separator [, multiset] [, singularity])

Returns the cardinality of the difference of sets (set1, set2).

symmetricDifference(set1, set2, separator [, multiset ] [, singularity])

Returns the cardinality of the symmetric difference of sets.

union(set1, set2, separator [, multiset])

Returns the cardinality of the union of sets.

Conditionals

Function Description

iif(ifExpr, trueExpr, elseExpr)

Returns trueExpr if ifExpr is true.

case(expr, exprValue[, expr, exprValue]…​[, defaultExpr])

Returns the value of the expression exprValue immediately following the first expression expr whose value is true.

decode(decodeExpr, expr, exprValue[, expr , exprValue]…​[, defaultExpr])

Returns the value of the expression exprValue immediately following the first expression expr whose value is equal to decodeExpr.

nvl(expr[, expr]…​)

Returns the value of the first expression expr whose value is not NULL.

Other operations

Function Description

getParameterValue(key [, default])

Returns the value of the property or the default value if there is no property with that key. All property names must have a prefix defining where the property should be read from.

The following prefixes are used:

  • system. - Get Java system property (typically: getParameterValue("system.java.version").

    A system property can be set or overridden by specifying the -D option to the Java command when running your program. For example, java.exe -Dmy.prop="my value" …​.

    To get the value of the system property you can use getParameterValue("system.my.prop").

  • env. - Get environment variable (typically: getParameterValue("env.JAVA_HOME").

  • http. - Get HTTP request parameters and some other properties related to HTTP request line getParameterValue("http.user-agent"), getParameterValue("http.soapAction"), getParameterValue("http.accept"), …​.

  • security. - Get information about the authenticated user, assigned security roles, and parameters connected with the authenticated user.

    • security.user - Returns the authenticated user name.

    • security.user.<attribute_name> - Returns the value of the 'attribute_name' attribute assigned to the current authenticated user. The value is assigned, for example, by setting LdapIdentityProvider and BasicAttribibuteResolver.

    • security.role.<role_name> - A Boolean indicator showing whether the authenticated user is assigned the role with name 'role_name'.

Starting from 13.9.0, we have changed how getParameterValue function behaves. To retrieve the value of an environment variable (with env. prefix), this option must now be explicitly configured for that variable.

In other words, you need to set ata.function.getParameterValue.allowed to a regular expression matching the enabled properties (for example, ata.function.getParameterValue.allowed=env.OS|env.TEMP). Properties JAVA_HOME, JRE_HOME, HOSTNAME, HOME, USER, and LANGUAGE are by default allowed.

To enable this option, proceed with the following steps, depending on your use case.

Run a plan
  1. In ONE Desktop, open the plan that you want to run.

  2. In the toolbar, next to the Run option, open the dropdown menu and select Run Configuration.

  3. In the dialog that opens, switch to the Runtimes tab.

  4. In VM arguments, add the following line:

    -Data.function.getParameterValue.allowed=<environment_variable>
  5. Replace the placeholder with the name of the environment variable that you want to use. To provide several variables, separate them using a vertical bar (|), for example:

    -Data.function.getParameterValue.allowed=env.HOMEDRIVE|env.ProgramW6432|env.CommonProgramFiles(x86)
  6. Select Apply to save your changes. You can now select Run to immediately execute your plan or select Close to continue editing it.

Debug a step
  1. Make sure ONE Desktop is not running while you are making these changes.

  2. Navigate to your ONE Desktop installation folder.

  3. Open the one-desktop.ini file in a text editor.

  4. Add the following line to the last line in the file:

    -Data.function.getParameterValue.allowed=<environment_variable>
  5. Replace the placeholder with the name of the environment variable that you want to use. To provide several variables, separate them using a vertical bar (|), for example:

    -Data.function.getParameterValue.allowed=env.HOMEDRIVE|env.ProgramW6432|env.CommonProgramFiles(x86)
  6. Save your changes and close the file.

  7. Start ONE Desktop. You can now use the specified environment variable when debugging steps.

Was this page useful?