Goal amount for this year: 2500 USD, Received: 1627 USD (65%)

# Thread: visibilty formula issue with yes/no

1. ## visibilty formula issue with yes/no

I have attached a family with some check boxes. what i am trying to do is: if none of the check boxes are selected the text is turned off, if any one of the check boxes is checked the text is turned off, if any combination of boxes is checked at the same time the text is turned on. (planning on using as a warning in the family) I have tried the formula in the family as well as the formula below. any help is appreciated.

if(and(or(OP1, OP2, or(OP1, OP3, or(OP1, OP4, or(OP1, OP5, or(OP2, OP3, or(OP2, OP4, or(OP2, OP5, or(OP3, OP4, or(OP3, OP5, or(OP4, OP5))))))))))), 1 = 0, 1 = 1)

2. Instead of all this, which does not work:
if(and(OP1, OP2, or(OP1, OP3, or(OP1, OP4, or(OP1, OP5, or(OP2, OP3, or(OP2, OP4, or(OP2, OP5, or(OP3, OP4, or(OP3, OP5, or(OP4, OP5)))))))))), 1 = 1, 1 = 0)

Do just this: put all the parameters in the OR condition, separated by commas.
or(OP1, OP2, OP3, OP4, OP5)

3. Originally Posted by Alfredo Medina

Do just this: put all the parameters in the OR condition, separated by commas.
or(OP1, OP2, OP3, OP4, OP5)
This seems like it would turn the text on when any one box is checked, instead of when any combination of boxes is checked.

I tackled this in one family using the following format:

or( and(OP1, or(OP2, OP3, ... , OPn)), and(OP2, or(OP1, OP3, ... OPn)), ... , and(OPn, or(OP1, OP2, ... , OPn-1)))

Continue ad infinitum. This ensures that selecting any combination of two or more options will return as true, but selecting any one option will be false. It's the brute-force option, and should definitely be composed in Notepad (or Notepad++), but it should give you the result you want.

4. Originally Posted by Robert Roffe
This seems like it would turn the text on when any one box is checked, instead of when any combination of boxes is checked. ...
The OR with multiple parameters covers both situations: either any one box is checked or any combination of boxes is checked. No need to continue ad infinitum.
Attached is the family if you want to test it.

5. Yes, the OR statement covers both; I phrased my opening statement poorly. The OR statement, however, will return true if one or more boxes are checked, not one result if one box is checked, and a separate result if multiple boxes are checked. The way I read the OP is that if more than one box is checked, then show text, otherwise do not show text. What my previous formula breaks down to is:

and(OP1, or(OP2, OP3, ..., OPn) - if option one is selected and any combinations of the other options are selected, the AND statement is true.

or( <nested AND statements> ) - if any AND statement is true, then the OR statement is true.

If more than one option is selected, at least one AND statement is true, and therefore the OR statement is true. If only one option is selected, none of the AND statements are true, and therefore the OR statement is not true. Also, if no options are selected, none of the AND statements can be true, and therefore the OR statement is not true. You can nest as many AND statements as you have options (up to the limitations imposed by Revit). This satisfies all three conditions set out in the OP.

I've uploaded my edits to the family, if you'd like to test it.

Edit: Alfredo's solution below requires two parameters, this requires one, albeit more complex, statement.

6. the problem is that the OP wants the yes/no parameter to be checked when 2 options are checked and be off when none or 1 is checked

7. Originally Posted by Robin Deurloo
the problem is that the OP wants the yes/no parameter to be checked when 2 options are checked and be off when none or 1 is checked
I see now. The second of the three conditions is "if any one of the check boxes is checked the text is turned off". Strange. Then the solution that I proposed above does not comply with this second condition.

8. It sounds like you're trying to limit the user's choice to one of several options. Maybe you could take the approach I wrote about in THIS blog POST. It describes using a nested family that has specific types that allow a user to only select from preset options. By only letting the user make one selection that's mapped to a specific result might eliminate the need for the warning.

I'll have to fix the download path for the example file...sorry...that'll be later tonight. There is a copy of the family in the thread here that I link to.

9. Originally Posted by Alfredo Medina
I see now. The second of the three conditions is "if any one of the check boxes is checked the text is turned off". Strange. Then the solution that I proposed above does not comply with this second condition.
ok, this is another solution which complies with all three requirements, if it is correct that the second requirement means that "if any one (1 only) of the check boxes is checked the text is turned off".

Attached is the revised version of the family if you guys want to test it.

Page 1 of 2 12 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•