Back to zzTakeoff Community Channel LogoDocumentation
Sam Romeo zzTakeoff
6d 22h

Formula Builder Help Guide

Getting Started with Formulas

Math.js formulas in ZZ allow you to create conditional calculations based on your takeoff properties. This guide will walk you through the basics and provide practical examples.

Important Note: When copying formulas from this guide into ZZ's calculation window, you'll need to retype them rather than copy-paste, as formatting may not carry over properly.


Basic Formula Structure

All conditional formulas follow this pattern:

if([Property] condition value, result_if_true, result_if_false)


Breaking Down a Basic Formula


Let's examine this example: if([Point Count]>=4, 8, 1)

  1. if - Starts every conditional formula
  2. ([Point Count]>=4, - The condition to test (is Point Count greater than or equal to 4?)
  3. 8, - The result if the condition is TRUE
  4. 1 - The result if the condition is FALSE


Result: If Point Count is 4 or higher, the formula returns 8. If Point Count is less than 4, it returns 1.


Comparison Operators

Use these operators to create your conditions:

OperatorMeaningExample>=Greater than or equal to[Height]>=6<=Less than or equal to[Width]<=10>Greater than[Length]>8<Less than[Count]<5==Exactly equal to[Wall Thickness]==8


Practical Examples


Example 1: Delivery Fee Calculation

if([Volume:CY]/[Truck Load CY]>= 10, 0, 1)

What it does: Calculates delivery charges based on truck loads

  • If 10 or more truck loads: No delivery fee (0)
  • If less than 10 truck loads: Add delivery fee (1)


Example 2: Material Length Selection

if([Linear:FT]<8, 1, 0)

What it does: Determines if you need 8-foot boards

  • If measured length is less than 8 feet: Use 1 eight-foot board
  • If measured length is 8 feet or more: Use 0 eight-foot boards


Example 3: Post Height Adjustments

(if([Post Height]>=6, 1, 0) + [Number of Clamps per Post]) * [Point Count]

What it does: Adds extra clamps for tall posts

  • If post is 6 feet or taller: Add 1 extra clamp per post
  • If post is shorter than 6 feet: No extra clamps


Advanced Formulas


Combining Multiple Conditions

if(and([Linear:FT]>8, [Linear:FT]<=10), 1, 0)

What it does: Checks if length falls within a specific range (greater than 8 AND less than or equal to 10)


Chaining Calculations

if([Point Count]>=4, 8, 1) * ([Volume:CY]/13)

What it does: First determines a base value, then multiplies by another calculation


Using Properties in Results

if([Point Count]<4, [Any Value], [Value of Anything]) + [Point Count]

What it does: Uses different property values as results rather than fixed numbers


Yes/No Switches

You can create dropdown switches in Custom Properties that work like checkboxes:

  • Yes = 1 (true)
  • No = 0 (false)


Setting Up a Yes/No Switch

  1. Create a Value & Name Custom Property
  2. Set up two options:
  3. Name: "Yes", Value: 1
  4. Name: "No", Value: 0
  5. Apply to your takeoff properties, in this case we used Linear and Segmented Takeoffs




Takeoff Property

You now have a custom property that works like checkboxes:

  • Yes = 1 (true)
  • No = 0 (false)




In the Formula Window at the Part with (Calculate Sheathing) Switch, you do not have to make the choice at the item level as this was made at the Takeoff level and it carries down. You just need to create the matching variable in the item.






Using Yes/No Switches in Formulas

[Point Count] * [Calculate Post Caps]

What it does:

  • If "Calculate Post Caps" is set to Yes (1): Calculates post caps normally
  • If "Calculate Post Caps" is set to No (0): Results in zero quantity



Common Use Cases for Other Formulas


Wall Thickness Calculations

if([Wall Thickness]==8, 1, 2) * [Linear:FT]/[Length of Product]

Use case: Different material quantities based on wall thickness


Production Rate Adjustments

((if([Post Height]>=6, 1.[Percentage of Increase], 1) * [Point Count]))/[Production Rate]

Use case: Adjust labor hours based on working height


Material Requirements with Switches

if([Wall Thickness]==8, 2, 1) * [Linear:FT]/[Length of Product] * [Sill Seal Required?]

Use case: Calculate materials only when needed, with quantity varying by specification


Tips for Success

  • Test your formulas with different values to ensure they work as expected
  • Use descriptive property names to make formulas easier to understand
  • Break complex formulas into smaller parts when possible
  • Document your formulas do this in a shared document so others can understand and maintain them
  • Remember that property values from takeoff level carry down to item level automatically providing you have the Same Property on that level


Getting Help

If you're having trouble with a formula:

  1. Check your parentheses - every opening parenthesis needs a closing one
  2. Verify property names are exactly as they appear in your takeoff
  3. Test with simple values first, then add complexity
  4. Make sure comparison operators are appropriate for your data type (currently the Formula Field is for Quantities on the Items so the result needs to be a number)
2
Jim Conley 9d 21h

Much appreciated, Sam.

Chasstan Prichard 4d 19h

I asked this question in "Q & A" community, but maybe here is better??? Or is this more of a kb/wiki???

You must be logged in to post replies. If you don't have an account you can signup here.