Math Functions

Mike Jones
Mike Jones
  • Updated

Math Functions

Performing mathematical operations on your data is handled by the various Math Functions. Each function has specific input and output specifications. One important thing to note is the input data types integer and double can produce different calculated values with some functions due to the difference between using a whole number vs. number with decimals. Make sure you are aware of the Data Type for the field used in the pipeline. 

 

Absolute Value

This function returns the absolute value of the input (ex. if -10 is received as an input, the function returns 10 as an output).

Configuration:

You can configure the Node Label on this function. There are no other configurable fields on the function. The function should be connected to a node that passes a number value (integer/double) into it.

Example:

You can find the absolute value of the result from the Decrement function.

Sync_Studio_-_Syncari_2021-01-06_at_7.51.49_PM.jpg

back to the top

Ceil

This function returns the smallest double value that is greater than or equal to the input value and is equal to a mathematical integer. This function is useful for rounding up to the nearest whole number. Special cases:

  • If the argument value is already equal to a mathematical integer, then the result is the same as the argument. 
  • If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument. 
  • If the argument value is less than zero but greater than -1.0, then the result is negative zero.

Configuration:

You can configure the Node Label and Description on this function. There are no other configurable fields. The function should be connected to a node that passes a number value (integer/double) into it.

Examples:

- If the Input value is 1, the function with Output the value, 1.
- If the Input value is 1.4, the function will Output the value, 2.

back to the top

Compute Ratio

The Compute Ratio function can be used to calculate the ratio based on 2 values. The numerator and denominator used with this function can be set as static values or values from fields by using a token. 

Configuration:

mceclip0.png

1. Enter a label for the node. This will be helpful with identifying the node when viewing your Entity Pipeline.

2. Enter a Description that will explain the criteria configured to attach the incoming source record to the existing Syncari Record. 

3. Enter the Numerator. This value can be dynamically set using a token. Use the Insert Token option to select a field.

4. Enter the Denominator. This value can be dynamically set using a token. Use the Insert Token option to select a field.

5. The function will return a number with decimals by default. Enabling this option will set the function to return a percentage. 

6. Set the number of decimal points to round to. 

back to the top

Decrement Value

The Decrement Value function can be used to subtract a specific number from the incoming value. It can also be configured to return the difference between the input value field value by use of a token. The value set on the function's configuration will be the value subtracted from the input value. 

Configuration:

mceclip2.png

1. Enter a label for the node. This will be helpful with identifying the node when viewing your Entity Pipeline.

2. Enter a Description that will explain the criteria configured to attach the incoming source record to the existing Syncari Record. 

3. The Amount to Subtract can be set to a number or a token. If this field is left blank it will default to zero.

4. Use the Insert Token picklist to set the Amount to Subtract as a reference to a field value. 

back to the top

Floor

The Floor function returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. This function is useful for rounding down to the nearest whole number.  Special cases:

  • If the argument value is already equal to a mathematical integer, then the result is the same as the argument. 
  • If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.

Configuration:

You can configure the Node Label and Description on this function. There are no other configurable fields. The function should be connected to a node that passes a number value (integer/double) into it.

Examples:

- If the Input value is 1, the function will return the value, 1.
- If the Input value is 1.4, the function will return the value, 1.

back to the top

Format Number

The number_format allows one to format a given number with specific symbols for the grouping and decimal separators, also the number of fractional digits. This function expects at least one argument and can receive up to four arguments.

Configuration:

mceclip3.png

1. Enter a label for the node. This will be helpful with identifying the node when viewing your Entity Pipeline.

2. Enter a Description that will explain the criteria configured to attach the incoming source record to the existing Syncari Record. 

3. Set the number of fractional digits on the number.

4. Use the Insert Token option to set the number of fractional digits dynamically using a field value. 

5. Set the character used for the decimal separator.

6. Use the Insert Token option to set the decimal separator dynamically using a field value. 

7. Set the character used for the grouping separator. 

8. Use the Insert Token option to set the grouping separator dynamically using a field value. 

 

Increment

The Increment Value function can be used to add a number to the incoming value. It can also be configured to return the sum of the input value field value by use of a token. The value set on the function's configuration will be the value added to the input value. 

Configuration:

Increment.jpg

1. Enter a label for the node. This will be helpful with identifying the node when viewing your Entity Pipeline.

2. Enter a Description that will explain the criteria configured to attach the incoming source record to the existing Syncari Record. 

3. The Amount to Add can be set to a number or a token. If this field is left blank it will default to zero.

4. Use the Insert Token picklist to set the Amount to Add as a reference to a field value. 

Output:

Input decremented by the Amount to Subtract.

back to the top

Multiply

The Multiply function returns the product of the input value and the value configured on the functions configuration. 

Configuration:

mceclip5.png

1. Enter a label for the node. This will be helpful with identifying the node when viewing your Entity Pipeline.

2. Enter a Description that will explain the criteria configured to attach the incoming source record to the existing Syncari Record. 

3. Set a static value here by entering a number. The function will default to multiplying by 1 if you leave this configuration field blank. You can insert a token to reference a value on a field if needed.

4. Use the Insert Token picklist to configure the function to multiply by a number value in a specific field. 

back to the top

Random

The Random function Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returned values are chosen pseudorandomly with (approximately) uniform distribution from that range.
Example values returned by this function:
0.7611968702330243
0.02226125037160276

Configuration:

You can configure the Node Label and Description on this function. There are no other configurable fields. The function should be connected to a node that passes a number value (integer/double) into it.

Examples:

This function can be used to generate a random number within a certain range. As an example, if you wanted to randomly generate a number from 0 to 100 you could setup your pipeline with the Random Number >> Multiply >> Floor functions like this:

mceclip6.png

Since we want to generate a random number from 0 to 100, the Multiply function in this example should be configured to multiply the Random Number by 101. You can set the value on the Multiply function to be 1 more than the top value in your range:
mceclip7.png

The Floor function in the pipeline is set to be able to return whole numbers. This should return an end result of a number between 0 and 100. 

back to the top

Round

The Round function returns the closest whole number to the input value. If the input is null, the function will return 0.

Configuration:

You can configure the Node Label and Description on this function. There are no other configurable fields. The function should be connected to a node that passes a number value (integer/double) into it.

Examples:

- If the Input value is 1.2, the function will return the value, 1.
- If the Input value is 1.5, the function will return the value, 2.

back to the top

Share this

Was this article helpful?

0 out of 0 found this helpful