Formula Builder

The Formula Builder is a powerful step-based visual editor used throughout TimberCloud for creating calculations without writing code. Build complex formulas by selecting values, operators, and measurements in an intuitive interface.
Overview
The same Formula Builder powers calculations across the platform:
| Feature | Use Case |
|---|---|
| Pricing | Calculate product prices based on dimensions, materials, and options |
| Parts | Determine part dimensions and quantities dynamically |
| Inventory | Calculate material deductions when orders are placed |
| Weight | Compute part weights from dimensions and density |
Learn it once, use it everywhere.
Getting Started
Accessing the Formula Builder
The builder opens from various locations depending on what you're calculating:
- Pricing: Product → Pricing → "Open Formula Builder"
- Parts: Product → Parts → Part dimension or quantity → "Edit Formula"
- Inventory: Product → Inventory → "Create Formula"
- Weight: Product → Parts → Weight → "Calculation" mode
Interface Overview
| Area | Purpose |
|---|---|
| Info Box | Tips and available operand types |
| Common Formulas | Quick-start templates for your context |
| Formula Preview | Visual representation of your formula |
| Formula Steps | Where you build your calculation step by step |
Operand Types
Each step in your formula uses one of these operand types:
Field
Reference values from the order or product:
Line Items
qty- Quantity orderedwidth- Item widthheight- Item heightdepth- Item depth/thicknesslength- Item lengthweight- Item weight
Product Options (Attributes)
material.price- Selected material's pricematerial.density- Material density valueedge.upcharge- Edge option upchargefinish.name- Selected finish name
Format: attribute_name.property
Number (Static)
Enter fixed numeric values:
- Constants:
144for square inch conversion - Multipliers:
1.10for 10% waste factor - Base values:
25for base price - Upcharges:
50for oversized fee
Measurement
Pre-built calculation formulas that automatically handle unit conversions:
| Measurement | Formula | Common Uses |
|---|---|---|
| Square Feet | (W × H) ÷ 144 | Panel pricing, sheet goods |
| Board Feet | (T × W × L) ÷ 144 | Lumber pricing, wood volume |
| Linear Feet | length ÷ 12 | Trim, molding, edge banding |
| Cubic Inches | W × H × D | Volume calculations |
| Cubic Feet | (W × H × D) ÷ 1728 | Bulk materials, shipping |
| Perimeter | 2 × (W + H) | Edge banding length |
| Waste Factor | value × (1 + waste%/100) | Add waste percentage |
When you select a measurement, you configure which fields provide the input values (width, height, thickness, etc.).
Group
Create parentheses for order of operations:
- Contains its own nested steps
- Essential for calculations like
(A + B) × C - Ensures correct mathematical precedence
If/Then/Else (Conditional)
Add logic-based calculations:
- Condition: Compare a field to a value
- Then Branch: Value/calculation if condition is true
- Else Branch: Value/calculation if condition is false
Supports comparison operators:
| Operator | Symbol | Description |
|---|---|---|
| Greater than | > | Value is greater |
| Less than | < | Value is less |
| Greater or equal | >= | Value is greater or equal |
| Less or equal | <= | Value is less or equal |
| Equals | = | Numeric equality |
| Not equals | != | Not equal |
| Is | is | Text equality |
| Contains | contains | Text contains |
Operators
Connect steps with mathematical operators:
| Operator | Symbol | Description |
|---|---|---|
| Add | + | Addition |
| Subtract | − | Subtraction |
| Multiply | × | Multiplication |
| Divide | ÷ | Division |
Building Formulas
Step-by-Step Process
- Click "Add Step" or start with a template
- Select operand type (Field, Number, Measurement, Group, Conditional)
- Configure the operand (select field, enter value, or set up measurement)
- Add another step if needed
- Select operator between steps (+, −, ×, ÷)
- Repeat until formula is complete
- Review preview to verify formula
- Save to apply
Common Formula Templates
Templates vary by context but typically include:
Pricing Templates
- Price per Square Foot
- Price per Board Foot
- Base + Per-unit pricing
- Tiered quantity pricing
Inventory Templates
- Quantity Only
- Board Feet × Quantity
- Square Feet × Quantity
- Field × Quantity
Part Dimension Templates
- Width + Overlay
- Height minus rail widths
- Calculated from line item
Formula Examples
Example 1: Pricing - Cabinet Door
Calculate door price based on square feet, material, and edge banding:
Square Feet(width, height) × material.price
+ Perimeter(width, height) × edge.price
+ IF width > 48 THEN 50 ELSE 0Steps:
- Measurement: Square Feet → width, height
- Operator: ×
- Field: material.price
- Operator: +
- Measurement: Perimeter → width, height
- Operator: ×
- Field: edge.price
- Operator: +
- Conditional: IF width > 48 THEN 50 ELSE 0
Example 2: Inventory - Sheet Goods with Waste
Calculate material deduction including 10% waste:
Square Feet(width, height) × qty × 1.10Steps:
- Measurement: Square Feet → width, height
- Operator: ×
- Field: qty
- Operator: ×
- Number: 1.10
Example 3: Part Dimension - Rail Length
Calculate rail length based on door width minus stiles:
width - (stile_width × 2) + lip_factorSteps:
- Field: width
- Operator: −
- Group:
- Field: design.stile_width
- Operator: ×
- Number: 2
- Operator: +
- Field: edge.lip_factor
Example 4: Weight - Calculated from Density
Calculate part weight from volume and material density:
Cubic Feet(width, height, depth) × material.densitySteps:
- Measurement: Cubic Feet → width, height, depth
- Operator: ×
- Field: material.density
Example 5: Conditional Pricing - Size Tiers
Different pricing for different sizes:
IF width > 48 THEN
Square Feet × 35
ELSE IF width > 36 THEN
Square Feet × 30
ELSE
Square Feet × 25Nested conditionals handle multiple tiers.
Advanced Features
Nested Groups
Create complex order of operations:
Formula: (base + material) × (1 + margin)
Group 1: (base_price + material.price)
×
Group 2: (1 + margin_percent)Nested Conditionals
Handle multiple conditions:
IF qty >= 100 THEN
price × 0.85
ELSE IF qty >= 50 THEN
price × 0.90
ELSE IF qty >= 25 THEN
price × 0.95
ELSE
priceCombining Measurements
Use multiple measurements in one formula:
Square Feet × price_per_sqft
+ Perimeter × edge_price
+ Cubic Feet × shipping_factorFormula Preview
The preview displays your formula visually:
| Badge Color | Meaning |
|---|---|
| Blue | Field references |
| Green | Static numbers |
| Purple | Measurements |
| Amber | Groups and conditionals |
| Green circles | Operators (+, −, ×, ÷) |
Use the preview to verify your formula structure before saving.
Context-Specific Usage
Pricing Formulas
- Access from Product → Pricing
- Result becomes the line item unit price
- Multiplied by quantity for line total
- See Pricing for detailed examples
Part Dimension Formulas
- Access from Product → Parts → Dimension specs
- Calculate width, length, height, depth
- Used in build sheets and shipping
- See Parts for configuration
Part Quantity Formulas
- Access from Product → Parts → Quantity
- Determine how many of each part per product
- Can be static, field-based, or calculated
- Example:
height / 12for one brace per foot
Part Weight Formulas
- Access from Product → Parts → Weight
- Calculate weight from dimensions and density
- Used for accurate shipping rates
- Example:
Cubic Feet × density
Inventory Formulas
- Access from Product → Inventory
- Calculate material deduction on order
- Supports waste factors and conversions
- See Inventory Management for details
Legacy Support
If you have existing calculations using the old code editor or visual flow:
- Legacy formulas continue to work - Backend evaluates them normally
- Yellow banner indicates legacy configuration is active
- Creating a new formula overrides the legacy configuration
- Migration recommended for consistency and easier editing
Best Practices
Keep It Simple
- Break complex formulas into logical groups
- Use descriptive field names in attributes
- Test with known values
Use Templates
- Start with common formulas when available
- Modify templates rather than building from scratch
- Save time on standard calculations
Order of Operations
- Use Groups (parentheses) to ensure correct order
- Preview formula to verify structure
A + B × Cis different from(A + B) × C
Testing
- Save the formula
- Create a test order with known values
- Verify the calculated result
- Adjust formula as needed
Troubleshooting
Formula Not Saving
- Ensure all required inputs are configured
- Check for empty field selections in measurements
- Verify the formula has at least one step
- Look for validation errors in the UI
Wrong Results
- Check field mappings in measurements
- Verify operator order (use groups if needed)
- Test with known values to isolate issues
- Confirm field names match exactly
Field Not Available
- Verify the attribute or line item exists on the product
- Check spelling matches exactly (case-sensitive)
- Ensure the attribute has the property you're referencing
Legacy Formula Conflicts
- Look for yellow "Legacy Configuration" banner
- Create new step-based formula to override
- Legacy formulas evaluated on backend only
Next Steps
- Pricing - Create product pricing formulas
- Parts - Configure part dimensions and quantities
- Build Sheet Builder - Create production documents
- Inventory Management - Track stock and deductions