Skip to main content

Calculator

Description

Calculator is a step in the Transform Plugin for Process Studio Workflows. The calculator step provides predefined calculation expressions that can be executed on input field values. It can take up to three input arguments (Field A, Field B and Field C) and a return type must be specified. You may perform multiple such calculations within the step that are independent of each other or depend on fields generated in previous calculations. There is an option to remove fields from the output after all values are calculated. This is useful for removing temporary values.

Note: The execution speed of the Calculator is far better than the speed provided by custom scripts (JavaScript).

Configurations

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

Calculations Available

The table below contains the available calculations and associated descriptions:

No.CalculationExplanation
1Set field to constant ACreate a field with a constant value.
2Create a copy of field ACreate a copy of a field with the given field value.
3A + BA plus B.
4A - BA minus B.
5A * BA multiplied by B.
6A / BA divided by B.
7A * AThe square of A.
8SQRT( A )The square root of A.
9100 * A / BPercentage of A in B.
10A - ( A * B / 100 )Subtract B% of A.
11A + ( A * B / 100 )Add B% to A.
12A + B *CAdd A and B times C.
13SQRT( AA + BB )Calculate ?(A2+B2)
14ROUND( 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).
15ROUND( 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".
16STDROUND( 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).
17STDROUND( A, B )Same rounding method used as in STDROUND (A) but with B decimals.
18CEIL( A )The ceiling function maps a number to the smallest following integer.
19FLOOR( A )The floor function maps a number to the largest previous integer.
20NVL( A, B )If A is not NULL, return A, else B. Note that sometimes your variable won't be null but an empty string.
21Date 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.

22Year of dateA Calculate the year of date A.
23Month of dateA Calculate number the month of date A.
24Day of year of dateA Calculate the day of year (1-365).
25Day of month of dateA Calculate the day of month (1-31).
26Day of week of dateA Calculate the day of week (1-7).
27Week of year of dateA Calculate the week of year (1-54).
28ISO8601 Week of year of dateA Calculate the week of the year ISO8601 style (1-53).
29ISO8601 Year of dateA Calculate the year ISO8601 style.
30Byte to hex encode of stringA Encode bytes in a string to a hexadecimal representation.
31Hex encode of stringA Encode a string in its own hexadecimal representation.
32Char to hex encode of stringA Encode characters in a string to a hexadecimal representation.
33Hex decode of stringA Decode a string from its hexadecimal representation (add a leading 0 when A i of odd length).
34Checksum of a file A using CRC-32Calculate the checksum of a file using CRC-32.
35Checksum of a file A using Adler-32Calculate the checksum of a file using Adler-32.
36Checksum of a file A using MD5Calculate the checksum of a file using MD5.
37Checksum of a file A using SHA-1Calculate the checksum of a file using SHA-1.
38Levenshtein Distance (Source A and Target B)Calculates the Levenshtein Distance
39Metaphone of A (Phonetics)Calculates the metaphone of A
40Double metaphone of ACalculates the double metaphone of A
41Absolute value ABS(A)Calculates the Absolute value of A.
42Remove 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.

43Date A - Date B (in days)Calculates difference, in days, between A date field and B date field.
44A + B + CA plus B plus C.
45First letter of each word ofa string A in capitalTransforms the first letter of each word within a string.
46UpperCase of a string ATransforms a string to uppercase.
47LowerCase of a string ATransforms a string to lowercase.
48Mask XML content from string AEscape XML content; replace characters with &values.
49Protect (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]]>.
50Remove CR from a string ARemoves carriage returns from a string.
51Remove LF from a string ARemoves linefeeds from a string.
52Remove CRLF from a string ARemoves carriage returns/linefeeds from a string.
53Remove TAB from a string ARemoves tab characters from a string.
54Return only digits from string AOutputs only Outputs only digits (0-9) from a string from a string.
55Remove digits from string ARemoves all digits (0-9) from a string.
56Return the length of a string AReturns the length of the string.
57Load file content in binaryLoads the content of the given file (in field A) to a binary data type (e.g.pictures).
58Add time B to date AAdd the time to a date, returns date and time as one value.
59Quarter of date AReturns the quarter (1 to 4) of the date.
60variable substitution in string ASubstitute variables within a string.
61Unescape XML contentUnescape XML content from the string.
62Escape HTML contentEscape HTML within the string.
63Unescape HTML contentUnescape HTML within the string.
64Escape SQL contentEscapes the characters in a String to be suitable to pass to an SQL query.
65Date A - Date B (working days)Calculates the difference between Date field A and Date field B (only working days Mon-Fri).
66Date 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.

67Check if an XML file A is well formedValidates XML file input.
68Check if an XML string A is well formedValidates XML string input.
69Get encoding of file AGuess the best encoding (UTF-8) for the given file.
70Dameraulevenshtein distance between String A and String BCalculates Dameraulevenshtein distance between strings: http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distanc
71NeedlemanWunsch distance between String A and String BCalculates NeedlemanWunsch distance between strings: http://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm
72Jaro similitude between String A and String BReturns the Jaro similarity coefficient between two strings.
73JaroWinkler similitude between String A and String BReturns the Jaro similarity coefficient between two string: http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance
74SoundEx of String AEncodes a string into a Soundex value.
75RefinedSoundEx of String ARetrieves the Refined Soundex code for a given string object
76Date 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.

77Date 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.

78Date A - Date B (milliseconds)Subtract B milliseconds from Date field A
79Date 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.

80Date 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.

81Date 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.

82Hour of Day of Date AExtract the hour part of the given date
83Minute of Hour of Date AExtract the minute part of the given date
84Second of Hour of Date AExtract the second part of a given date
85Second of Minute of Date A
86ROUND_CUSTOM(A,B)
87ROUND_CUSTOM(A,B,C)
88Date A + B Seconds
89Remainder of A / B