Skip to main content

Calculator

Description

Calculator performs predefined mathematical, date, and string calculations on input field values at high execution speed. Use this step when you need common calculations without writing scripts — for example, computing date differences, rounding numbers, extracting parts of strings, or performing arithmetic on multiple fields. It accepts up to three input arguments per calculation, supports chaining calculations where later expressions reference earlier results, and runs significantly faster than equivalent JavaScript-based approaches. You can also remove temporary calculation fields from the output to keep the stream clean.

Configurations

Field NameDescription
New fieldThis field is populated by the value of the calculation. This field can be temporary or permanent.
Calculation*This field contains the expression of the calculation.
Field AAn input for the calculation
Field BAn input for the calculation
Field CAn input for the calculation
Value typeIt is the data type of the new field
LengthIt is the length of the data type
PrecisionIt is the precision of the data type
RemoveIf remove is selected then the value in the new field is deleted after completion of the step. It can be used for interim calculations.
Conversion maskDate or Number format
Decimal symbolThe decimal digits and precision separator
Grouping symbolThe thousand separator
Currency symbolCurrency symbol

Calculations Available

The table below contains the available calculations and associated descriptions:

CalculationExplanation
Set field to constant ACreate a field with a constant value.
Create a copy of field ACreate a copy of a field with the given field value.
A + BA plus B.
A - BA minus B.
A * BA multiplied by B.
A / BA divided by B.
A * AThe square of A.
SQRT( A )The square root of A.
100 * A / BPercentage of A in B.
A - ( A * B / 100 )Subtract B% of A.
A + ( A * B / 100 )Add B% to A.
A + B *CAdd A and B times C.
SQRT( AA + BB )Calculate ?(A2+B2)
ROUND( A )Returns the closest Integer to the argument. The result is rounded to an Intege by adding 1/2, taking the floor of the result, and casting the result to type int. I other words, the result is equal to the value of the expression: floor (a + 0.5). In case you need the rounding method "Round half to even", use the followin method ROUND( A, B ) with no decimals (B=0).
ROUND( A, B )Round A to the nearest even number with B decimals. The used rounding method is "Round half to even", it is also called unbiased rounding, convergen rounding, statistician's rounding, Dutch rounding, Gaussian rounding, odd-eve rounding, bankers' rounding or broken rounding, and is widely used in bookkeeping. This is the default rounding mode used in IEEE 754 computing functions and operators. In Germany it is often called "Mathematisches Runden".
STDROUND( A )Round A to the nearest integer. The used rounding method is "Round half awa from zero", it is also called standard or common rounding. In Germany it is known as "kaufmännische Rundung" (and defined in DIN 1333).
STDROUND( A, B )Same rounding method used as in STDROUND (A) but with B decimals.
CEIL( A )The ceiling function maps a number to the smallest following integer.
FLOOR( A )The floor function maps a number to the largest previous integer.
NVL( A, B )If A is not NULL, return A, else B. Note that sometimes your variable won't be null but an empty string.
Date A + B daysAdd B days to Date field A.

Note: Only integer values for B are supported. If you need non-integer calculations, please add a second calculation with hours.

Year of dateA Calculate the year of date A.
Month of dateA Calculate number the month of date A.
Day of year of dateA Calculate the day of year (1-365).
Day of month of dateA Calculate the day of month (1-31).
Day of week of dateA Calculate the day of week (1-7).
Week of year of dateA Calculate the week of year (1-54).
ISO8601 Week of year of dateA Calculate the week of the year ISO8601 style (1-53).
ISO8601 Year of dateA Calculate the year ISO8601 style.
Byte to hex encode of stringA Encode bytes in a string to a hexadecimal representation.
Hex encode of stringA Encode a string in its own hexadecimal representation.
Char to hex encode of stringA Encode characters in a string to a hexadecimal representation.
Hex decode of stringA Decode a string from its hexadecimal representation (add a leading 0 when A i of odd length).
Checksum of a file A using CRC-32Calculate the checksum of a file using CRC-32.
Checksum of a file A using Adler-32Calculate the checksum of a file using Adler-32.
Checksum of a file A using MD5Calculate the checksum of a file using MD5.
Checksum of a file A using SHA-1Calculate the checksum of a file using SHA-1.
Levenshtein Distance (Source A and Target B)Calculates the Levenshtein Distance
Metaphone of A (Phonetics)Calculates the metaphone of A
Double metaphone of ACalculates the double metaphone of A
Absolute value ABS(A)Calculates the Absolute value of A.
Remove time from a date ARemoves time value of A.

Note: Daylight Savings Time (DST) changes in Sao Paulo and some other parts of Brazil at midnight 0:00. This makes it impossible to set the time to 0:0 at the specific date, when the DST changes from 0:00 to 1:00 am. So, there i one date in one year in these regions where this function will fail with an "IllegalArgumentException: HOUR_OF_DAY: 0 -> 1". It is not an issue for Europe, the US and other regions where the time changes at 1:00 or 2:00 or 3:00 am.

Date A - Date B (in days)Calculates difference, in days, between A date field and B date field.
A + B + CA plus B plus C.
First letter of each word ofa string A in capitalTransforms the first letter of each word within a string.
UpperCase of a string ATransforms a string to uppercase.
LowerCase of a string ATransforms a string to lowercase.
Mask XML content from string AEscape XML content; replace characters with &values.
Protect (CDATA) XML content from string AIndicates an XML string is general character data, rather than non-character data or character data with a more specific, limited structure. The given string will be enclosed into <![CDATA[String]]>.
Remove CR from a string ARemoves carriage returns from a string.
Remove LF from a string ARemoves linefeeds from a string.
Remove CRLF from a string ARemoves carriage returns/linefeeds from a string.
Remove TAB from a string ARemoves tab characters from a string.
Return only digits from string AOutputs only Outputs only digits (0-9) from a string from a string.
Remove digits from string ARemoves all digits (0-9) from a string.
Return the length of a string AReturns the length of the string.
Load file content in binaryLoads the content of the given file (in field A) to a binary data type (e.g.pictures).
Add time B to date AAdd the time to a date, returns date and time as one value.
Quarter of date AReturns the quarter (1 to 4) of the date.
variable substitution in string ASubstitute variables within a string.
Unescape XML contentUnescape XML content from the string.
Escape HTML contentEscape HTML within the string.
Unescape HTML contentUnescape HTML within the string.
Escape SQL contentEscapes the characters in a String to be suitable to pass to an SQL query.
Date A - Date B (working days)Calculates the difference between Date field A and Date field B (only working days Mon-Fri).
Date A + B MonthsAdd B months to Date field A.

Note: Only integer values for B are supported. If you need non-integer calculations, please add a second calculation with days.

Check if an XML file A is well formedValidates XML file input.
Check if an XML string A is well formedValidates XML string input.
Get encoding of file AGuess the best encoding (UTF-8) for the given file.
Dameraulevenshtein distance between String A and String BCalculates Dameraulevenshtein distance between strings: http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distanc
NeedlemanWunsch distance between String A and String BCalculates NeedlemanWunsch distance between strings: http://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm
Jaro similitude between String A and String BReturns the Jaro similarity coefficient between two strings.
JaroWinkler similitude between String A and String BReturns the Jaro similarity coefficient between two string: http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance
SoundEx of String AEncodes a string into a Soundex value.
RefinedSoundEx of String ARetrieves the Refined Soundex code for a given string object
Date A + B HoursAdd B hours to Date field.

Note: Only integer values for B are supported. If you need non-integer calculations, please add a second calculation with minutes.

Date A + B MinutesAdd B minutes to Date field.

Note: Only integer values for B are supported. If you need non-integer calculations, please add a second calculation with seconds.

Date A - Date B (milliseconds)Subtract B milliseconds from Date field A
Date A - Date B (seconds)Subtract B seconds from Date field A.

Note: Only integer values for B are supported. If you need non-integer calculations, please add a second calculation with milliseconds.

Date A - Date B (minutes)Subtract B minutes from Date field A.

Note: Only integer values for B are supported. If you need non-integer calculations, please add a second calculation with seconds.

Date A - Date B (hours)Subtract B hours from Date field A.

Note: Only integer values for B are supported. If you need non-integer calculations, please add a second calculation with minutes.

Hour of Day of Date AExtract the hour part of the given date
Minute of Hour of Date AExtract the minute part of the given date
Second of Hour of Date AExtract the second part of a given date
Second of Minute of Date A
ROUND_CUSTOM(A,B)
ROUND_CUSTOM(A,B,C)
Date A + B Seconds
Remainder of A / B