Number Operations
The Number Operations building block allows you to perform various mathematical and formatting operations on numbers. If the value to apply the operation on is empty, the TaskBot will take no action and continue its run.
Add
Combine two numbers or concatenate two strings.
Examples
1 + 1 ⟶ 2
"hello" + " world" ⟶ "hello world"
Use Case Example
Add a counter to limit number of actions per TaskBot run. See example set-up: Example: Use variable to limit number of DMs sent per run
Subtract
Subtract one number from another.
Example: 5 - 3 ⟶ 2
Multiply
Multiply two numbers.
Example:
4 * 3
⟶12
See a use case example here: Example: Standardize different formats
Divide
Divide one number by another.
Example: 10 / 2 ⟶ 5
Remainder %
Return the remainder after dividing one number by another.
Example: 13 % 5 ⟶ 3
Round
Round a number to the nearest whole number.
Example: 2.6 ⟶ 3
Round up
Round a number up to the nearest whole number.
Example: 2.2 ⟶ 3
Round down
Round a number down to the nearest whole number.
Example: 2.7 ⟶ 2
Get random number
Generate a random number within a specified range.
If no minimum or maximum values are provided, the TaskBot will use the default values: 0 for the minimum and 1,000,000,000 for the maximum.
Example: Minimum 1, maximum 5 ⟶ 3.45
Set decimals
Set the number of decimal places for a number.
Example: 2 decimals: 5 ⟶ 5.00, 5.5333 ⟶ 5.53
Remove formatting
Remove formatting such as commas or dots in a number.
If a number is used for arithmetic calculations (+, -, /, *) or numeric comparisons (> or <), it is recommended to first convert it to a clean number for higher reliability. This is when this operation comes in handy.
Examples
1.000.000,23 is dot-grouped and will be converted to 1000000.23
1,000,000.23 is comma-grouped and will be converted to 1000000.23
1,000.000.23 has wrong format and an error report will be generated
Additional Notes
If the value to perform the operation on (e.g., value to add to, number to round up) is not provided, the operation is skipped, and the TaskBot will continue without making changes.
For operations requiring two values (e.g., add, subtract), if the value to use is not provided, the operation is skipped, and the TaskBot will continue without making changes.
If the operation requires a valid number (any operation except Add) and the input is not a number, the TaskBot will generate an error report and stop the run.
Last updated
Was this helpful?