GateFrames :: Formula Syntax Guide
Overview
Write formulas to calculate prices or validate restrictions using simple math and logic.
Variables are referenced with @variable and are case-insensitive (e.g., @Width equals @width). For dimensions and material math, author with
Variables
- Use
@nameto reference a variable, for example@width. - Text variables compare with strings using
'single'or"double"quotes. - Variables are case-insensitive:
@Color==@color.
Operators & Precedence
Use ^ for exponent, word-logic operators, and standard comparisons:
() [] {} → ^ → * / % → + - → == != < > <= >= → and or not xor → =
Functions
Common math: sqrt, abs, sin, cos, tan, log(x, base), exp, round, floor, ceil.
Conditionals
Use the ternary operator: condition ? value_if_true : value_if_false.
String Comparisons
Compare text variables with == or !=. Example: @color == 'red' ? 10 : 0
Examples
Price based on width (inches):
@width > 10 ? 100 : 50 Add 15% if color is premium:
@color == 'gold' ? 1000 * 1.15 : 1000 Restriction (must be true/false), width in inches:
@quantity >= 1 and @width_in <= 120Notes
- Use
^for power:2^3(not2**3). - Use word-logic:
and,or,not,xor(not&&or||). - Formulas should evaluate to a number (price) or boolean (restriction).
- Avoid division by zero or results that are
Infinity/NaN.