Basic math expression parser
Configuration options
- Operator - The operation to apply:
+,-,*or/. - Number - The number to add, subtract, multiply or divide by. It must be a number from 0 to 9999999999999 and use a period as the decimal separator.
The scraped value is always on the left side of the calculation. The result is a number in JSON output.
Add VAT to a price
Source:
100
Operator:
*
Number:
1.21
Result:
121
Convert units
Divide or multiply by a fixed factor to change the unit of a value, for example from grams to kilograms.
Source:
12345
Operator:
/
Number:
1000
Result:
12.345
Add or subtract a fixed amount
Example:
Source: 100
Operator: +
Number: 10
Result: 110
To subtract, select - and enter a positive number.
The value must start with a number
The parser reads the number at the start of the value and ignores the rest. A value that does not start with a number is treated as 0.
12 reviews + 10 → 22
1,234.50 + 10 → 11
$416.99 + 10 → 10
Sold out + 10 → 10
Remove extra characters first
Use Replace text before the calculation so the value contains only the number.
Example source:
$1,234.50
Configuration of the Replace text parser:
Text to replace: [^0-9.-]
Text to place:
Use Regex: Yes
Configuration of the Basic math expression parser:
Operator: +
Number: 10
Result:
1244.5
Results are not rounded
Results keep full precision, so some decimal calculations show floating-point digits:
10 / 3 → 3.3333333333333335
0.07 * 100 → 7.000000000000001
The preview and JSON output show the full value. CSV downloads can write it with
fewer digits, for example 7 instead of 7.000000000000001.
Round the values in the system that uses the data when a fixed number of decimals is required.
Limits
- Number cannot be negative.
- Division by 0 is not allowed.
- Each parser applies one operation. For several steps, add several Basic math expression parsers to the column. They run from left to right.
Troubleshooting
- If a result stays the same whatever the source value, the source value does not start with a number and is treated as 0. Remove the text before the number with Replace text.
- If the result uses only the first digits of a larger number, remove thousands separators first.
- Check parser order when another parser changes the value before the calculation.