IF/THEN Formula and "Yes/No" Parameter

IF/THEN Formula and "Yes/No" Parameter

clippincott-CL
Advocate Advocate
310,033 Views
57 Replies
Message 1 of 58

IF/THEN Formula and "Yes/No" Parameter

clippincott-CL
Advocate
Advocate
I have created two "Yes/No" parameters in a family and associated each of them with the visibility of a different symbol in the family. If one of these parameters is set to "Yes", I want the other set to automatically be set to "No", and vice/versa.

I was trying to achieve this by making a formula that basically says, IF X=Yes THEN Y=No but I don't know how to reference the values of "Yes" or "No" in my formula, Revit tells me that "Yes" and "No" are not valid family parameters. I also tried "True" and "False" but got the same result.

Any ideas as to how I can do this? Any suggestions will be appreciated.
0 Likes
Accepted solutions (3)
310,034 Views
57 Replies
Replies (57)
Message 21 of 58

L.Maas
Mentor
Mentor

Few issues:

-If you make a communication device schedule, your nested families should also belong to that category to be able to show up in the schedule (now it is generic)

-You have to make the nested families Shared to be able to schedule them.

 

Shared.png

Louis

EESignature

Please mention Revit version, especially when uploading Revit files.

Message 22 of 58

Anonymous
Not applicable

@EnlInt wrote:

Few issues:

-If you make a communication device schedule, your nested families should also belong to that category to be able to show up in the schedule (now it is generic)

-You have to make the nested families Shared to be able to schedule them.

 

Shared.png


Thank you, Enlint.

That all makes sense. Everything works perfect now. Thanks, again. Kudos to you.

0 Likes
Message 23 of 58

GTisRuleX
Advocate
Advocate

I've been trying to figure out how to do this for a few years now.  FINALLY stumbled across this post on a google search!

 

THANK YOU!

 

0 Likes
Message 24 of 58

Anonymous
Not applicable

Adding this because nobody else had it...

 

I have made dummy "Yes" and "No" parameter with the checkmark on/off respectively. Then if I have a family that has multiple options I can create an IF equation that allows me to refer back to "Yes" or "No".

 

Ex: if(Window Option < 1, No, if(Window Option > 3, No, Yes))

 

In the above equation I wanted one element to be visible for options 1-3 only. It could also be written on the long way with:

if(Window Option = 1, Yes, if(Window Option = 2, Yes, if(Window Option = 3Yes, No)))

0 Likes
Message 25 of 58

Sujan.Maharjan
Collaborator
Collaborator

Here we go . 

1. When you need to check one of two parameter

2. When you have more than two parameters. Where "Visibility of ABC" is a integer data type..

TIP 1: Use "_" instead of "-" in a parameter name

TIP 2:  https://www.revitforum.org/tutorials-tips-tricks/1046-revit-formulas-everyday-usage.html

 

2018-07-27_7-25-24.jpg


"Revit Lies in the tension between what we want to do and what can be done!"
0 Likes
Message 26 of 58

joekozelka
Enthusiast
Enthusiast

That worked 

Thanks!

 

Joe 

0 Likes
Message 27 of 58

luis_brionesalonso
Advocate
Advocate

Hi, I have a question relating to this topic but can't figure out the solution. 

 

I have three YES/NO parameters A, B, and C. Parameter A is only visibly when a certain condition is met and is working as intended. Parameter B is a simple tick box (YES/NO instance parameter). 

 

What I want to achieve is the following: If  A=YES, then  C=NO. If  A=NO, then  C=NOT(B). I cant't manage to pour this functionality into a formula for parameter C. Anybody any idea's?

0 Likes
Message 28 of 58

Anonymous
Not applicable

Right now I assume you have certain conditions that control "A" being checked on unchecked.

 

Use the following equation:

C =IF(A, not(A), not(B))

If the conditions for A are met, then use the opposite of A. If not, then use the opposite of B.

A_Unchecked.JPGB_Checked.JPGB_Unchecked.JPG

0 Likes
Message 29 of 58

ToanDN
Consultant
Consultant

@luis_brionesalonso wrote:

Hi, I have a question relating to this topic but can't figure out the solution. 

 

I have three YES/NO parameters A, B, and C. Parameter A is only visibly when a certain condition is met and is working as intended. Parameter B is a simple tick box (YES/NO instance parameter). 

 

What I want to achieve is the following: If  A=YES, then  C=NO. If  A=NO, then  C=NOT(B). I cant't manage to pour this functionality into a formula for parameter C. Anybody any idea's?


if(not(A), A, not(B))

0 Likes
Message 30 of 58

luis_brionesalonso
Advocate
Advocate

Works like a charm, thank you.

0 Likes
Message 31 of 58

Anonymous
Not applicable

It's really working. Thanks for sharing this.

0 Likes
Message 32 of 58

Anonymous
Not applicable

Hello,

 

hope some one can help me with this problem i have with a formula.

 

i have a pipe accessory with 2 flange you can turn on and off with the YES/NO parameter. 

this is the formula i got written now: if(Flens lengte = 55 + Flens_1 = , 55 mm, if(Flens lengte = 52 + Flens_1 , 52 mm, 1 mm))

but i cant figure out how to write the YES/NO Flens_1 value. 

 

hope i made it a bit clear

0 Likes
Message 33 of 58

Anonymous
Not applicable

Are you able to accept the formulas as they are now? I would assume you cannot. It looks like you have an extra "=" sign. Additionally, you should not be able to add 55mm+Flens_1 because they do not have the same units (Flens_1 is just a yes/no parameter). I am not sure what you are trying to accomplish when you add Flens_1 in that formula.

0 Likes
Message 34 of 58

Anonymous
Not applicable

well my idea behind this formula is that it has to look at 2 if statements, because i got 2 diffrent lenght type's of flange.

i want the formula to first look at the size of the flange if its 55mm if that's true it has to look at the yes/no parameter and if thats also true the lengt will be 55 mm. if one of those are false then the formula has to look further again at the size of the flange if its 52mm and at the yes/no parameter the size of the flange will go to 52mm, if both formula's are false the size of the flange has to become 1mm. but the problem i have is, i dont know how to write the yes/no parameter properly in this formula.

 

i hope i made it a bit clearer, the is one of my first times im working with these kind of formula writing.

 

0 Likes
Message 35 of 58

Anonymous
Not applicable

Thanks!!

I stay in 2019 and your reply help me 😄

0 Likes
Message 36 of 58

Anonymous
Not applicable

"Yes", "true","false" or "no" are not constants in Revit.
However, you can get boolean value by typing an expression! E.g. 0=0 returns True, 0=1 returns False.

For shure, theese expressions can be used in formulas.

 

Bonus: there's also a fun trick with repeating condition expression three times.
Formula =if(a>1, a>1, a>1) returns True when exression is true, and False when not.
UPD: of course, in last case  =a>1   is just enough.
yes or no.png

Message 37 of 58

Anonymous
Not applicable

I have a similar issue. I have a lighting track family and need one head type not to exist if the track is shorter than 6'-0". If the track is 6-10' there should be x1 head shown, after that the math works out fine for the family. I tried adding an IF parameter but it tells me I have invalid value or inconsistent units, or my family breaks. 

0 Likes
Message 38 of 58

jlucasDVD7D
Observer
Observer

Thank you for this, Alfredo. Using your example, is there a way to limit the range of acceptable integers to 1-4?

0 Likes
Message 39 of 58

Anonymous
Not applicable

please find the below revit file in the attachment, go to family parameter and go down to others there u can find the yes/no with if formula

0 Likes
Message 40 of 58

Anonymous
Not applicable

Revit cannot recognized "True" "False" in formula but you can use a false statement and true statement.

For example, in your case. Lets say "V1" and "V2" as the two visibility parameters you want to control.

 

I will write formula for "V2" as follow,

"V2" = if(V1, 1>2, 1<2)

I use 1>2 as false statement and 1<2 as true statement, you can also use other type of statement. so this formula means "if V1 is true, V2 is false(1>2) otherwise V2 is true(1<2)". And you can control "V1" as instant parameter or formula, as long as "V1" is on "V2" will off.

I hope this will helpful for your case Cheers!

0 Likes