Revit Formula - Constraining Text Values with Yes/No Parameters

Cover.png

Formulas are a very powerful and undervalued feature within Revit. They allow for control of parametric content within a model, and range from simple equations to highly complex solutions. 


In this post I will demonstrate a simple formula to control a Text Value with Yes / No parameters. A key thing to remember is that the text you want to display will ALWAYS need to be within "quotation marks"; as is required when defining a text value through the Formula column.

 

To set up this type of Formula, you need to have at least 1 Yes / No parameter.

 

I have used a simple If statement to control based on 2 options:

if(Option A, "Title to Match Option A", if(Option B, "Title to Match Option B", "Option not defined"))

This equation refers to when the element is selected (Yes = 1)

 

When Option A is selected, the text value will constrain to Title to Match Option A.

Image 1.jpg

 

When Option B is selected, the text value will constrain to Title to Match Option B.

Image 2.jpg

 

When no options are selected, the text value will constrain to Option not defined.

Image 3.jpg

 I like to use these equations to identify when a model is not configured correctly, adding in "checks and balances" to my content.

 

When BOTH options are selected, I wanted this formula to identify there was an issue with the options. Reorganizing the equation and adding in a statement to identify when both options were selected allowed me to control the output to return the value Resolve Option Issue

if((and(Option A, Option B)), "Resolve Option Issue", if(Option A, "Title to Match Option A", if(Option B, "Title to Match Option B", "Option not defined")))

Image 4.jpg

You don't have to stop here! with slight changes and potentially more options you can further constrain these parameters to suite any scenario. 

 

Helpful Links:

Autodesk - Revit Models - Formulas 

Applied Software - Revit Formulas for Parametric Family Creation 

RevitIQ - Getting to know Revit formulas!

Autodesk - Other Revit Formula Posts

12 Comments