math

The math operation allows you to perform mathematical calculations on input data. You can reference field values inside a formula by using curly braces {}. The result of the calculation is returned as the new field value.

How it works

  • Define a formula in the Expression field.
  • Insert variables by wrapping field names in {}.
  • When the operation runs, these placeholders are replaced with the actual field values and the formula is calculated.

Example:

  • Input field: age = 30
  • Formula: {age} * 2
  • Result: 60

Supported Operators

  • Addition: 3 + 2 → 5
  • Subtraction: 7 – 4 → 3
  • Multiplication: 6 * 2 → 12
  • Division: 10 / 2 → 5
  • Exponentiation: 2 ^ 3 → 8
  • Parentheses: (2 + 3) * 4 → 20

Supported Functions

  • sqrt(x) → square root → sqrt(9) = 3
  • abs(x) → absolute value → abs(-5) = 5
  • round(x) → round to nearest → round(2.7) = 3
  • floor(x) → round down → floor(2.7) = 2
  • ceil(x) → round up → ceil(2.2) = 3
  • log(x) → natural logarithm → log(10) ≈ 2.3
  • sin(x) → sine → sin(0) = 0
  • cos(x) → cosine → cos(0) = 1

Usage in PalDock

Use match when you need to:

  • Compute derived values (e.g. double the user’s age: {age} * 2).
  • Apply numeric transformations before sending data to an API.
  • Normalize or scale values (e.g. {price} / 100 to convert cents to dollars).
  • Combine multiple fields in calculations ({length} * {width}).

Best Practices

  • Always ensure the input fields contain numeric values; invalid or empty inputs will result in calculation errors.
  • Use parentheses to control operator precedence.
  • Use rounding (round, floor, ceil) when working with floating-point results if the target system expects integers.
  • Keep formulas simple and easy to understand for maintainability.

References

chriskonnertz/string-calc

Insights that
helps you grow

  • Platform Pick 12: Rollout
    As you approach the official rollout of your affiliate platform, it’s time to take a step back and make sure everything is in place. A…
  • Platform Pick 11: Integrate and Test it
    When it comes to affiliate marketing, tracking clicks and leads is key to making sure you’re paying affiliates correctly and measuring success. But it’s not…
  • Platform Pick 10: Business, Legal, and IT Prep
    Now that you’ve narrowed down your platform choice, it’s time to make sure everything checks out from a business, legal, and technical perspective. This step…