Unqork Formulas

Overview

Unqork logic components let you use formulas in your configuration. Components that support formulas are the Calculator, Initializer, and Data Workflow components. You can enter formulas into the Output table of the Calculator and Initializer components. Using formulas in the Data Workflow operator depends on the operators you configure. For example, the Formula operator supports formula configuration.

Below is a list of Unqork-specific formulas that exist outside the standard Hot-Formula-Parser library.

To learn more about the Hot Formula Parser library, see our Additional Formulas article.

Formula Description Syntax Reference

ALPHARANGE

Returns an alphanumeric range from first to last letter.

ALPHARANGE(value1, value2)

For example, ALPHARANGE('A', 'D') = ['A', 'B', 'C', 'D']

BASE64

Transforms a binary value into a Base64 Base64 is an encoding and decoding technique used to convert binary data to an ASCII (American Standard for Information Interchange) text format. encoded string.

BASE64(value)

 

DATEADD

Adds or subtracts an interval from a date.

DATEADD(serial_number, interval, type)

 Moment.js ADD Function

DATEFORMAT

Converts a date-time value to a string with a specified format.

DATEFORMAT(serial_number, format, [offset])

 Moment.js FORMAT Function

DURATION

Checks the duration elapsed between two dates in a given time unit.

DURATION(start_date, end_date, unit_of_time)

 Moment.js DURATION Function

FROMBASE64

Converts a specified string that encodes binary data as base-64 digits to a string.

FROMBASE64(value)

 

GET

Gets a path in an object.

GET(object, path, [default_value])

 Lodash GET Function

GROUPBY

Groups rows into a set of summary rows, and returns one row for each group.

GROUPBY(array, group_by_field, aggregate_function, aggregate_field)

 Lodash GROUPBY Function

INITIAL

Extracts a given number of elements from the sbeginning of an array.

INITIAL(array, number)

 

JOINKEYVALUE

Links rows between tables.

JOINKEYVALUE(array, label_label, value_label, [colon], [semicolon])

 

JOINKEYVALUEARRAY

Merges elements of one or more array and appends the values to the end of the previous array.

JOINKEYVALUEARRAY(array, key_field, label_label, value_label, [colon], [semicolon])

 

JSONPARSE

Takes a JSON JSON (JavaScript Object Notation) is an open standard file and data interchange format. Unqork uses JSON for submission (record) data. string and passes it through JSON.parse, returning it as an object.

JSONPARSE(text)

 

KEYSARRAY

Returns a new array iterator object containing a key for each item in the array.

KEYSARRAY(array, keys)

 

LABELVALUEARRAY

Assigns labels to values in an array.

LABELVALUEARRAY(label_array, value_array, label_key, value_key)

 

LINKHEADERPARSE

Takes a header string and returns an object.

LINKHEADERPARSE(text)

For example, LINKHEADERPARSE("<http://example.com >; rel="example"; title="Example Website"") => [ { uri: 'http://example.com ', rel: 'example', title: 'Example Website' } ]

NUMERAL

Converts text to a number.

NUMERAL(number, format)

 Numbro.js FORMAT Function

PHONENUMBER

Converts letters to numbers and numbers to letters on a telephone keypad.

PHONENUMBER(value1, [value2], ...)

 

REST

Returns the remaining elements of an array past the index.

REST(array, index)

 

SPELLNUMBER

Takes a number and returns it in written form in a specified language.

SPELLNUMBER(number, locale, currency_code, [precision])

The locale must be in English and the currency_code must be in the United States dollar.

STRINGIFY

Converts a JavaScript JavaScript is an object-oriented computer programming language. It is most-commonly used for interactive effects in the browser. object or value to a JSON string.

STRINGIFY(object)

 

TOBASE64

Transforms a binary value into a Base64 encoded string.

TOBASE64(value)

 

URLPARSE

Takes a URL string and returns an object.

URLPARSE(text)

For example, URLPARSE("http://foo/bar") => { host: 'foo', pathname: '/bar' }

WORDWRAP

Wraps a string in new lines after a specified number of characters.

WORDWRAP(text, width, indent, [new_line], [cut], [trim])

 

WORDWRAPARRAY

Wraps a text string at a specified number of characters with a string break.

WORDWRAPARRAY(array, joiner, prepend_key_to_indent, width, indent, new_line, [cut], [trim])