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

Page 1 of 2 12 LastLast
Results 1 to 10 of 18
Like Tree8Likes

Thread: visibilty formula issue with yes/no

  1. #1
    New Member
    Join Date
    October 31, 2013
    Posts
    3
    Current Local Time
    11:49 AM

    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)
    Attached Files Attached Files

  2. #2
    Moderator DaveP's Avatar
    Join Date
    January 10, 2011
    Location
    St Paul, MN
    Posts
    2,984
    Current Local Time
    12:49 PM

  3. #3
    Forum Co-Founder Alfredo Medina's Avatar
    Join Date
    December 7, 2010
    Location
    Orlando, FL, USA
    Posts
    3,100
    Current Local Time
    01:49 PM
    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)

    Attached Thumbnails Attached Thumbnails visibilty formula issue with yes/no-2018-12-26_12-22-03.jpg  

  4. #4
    Junior Member
    Join Date
    September 19, 2017
    Location
    Seattle, WA
    Posts
    43
    Current Local Time
    10:49 AM
    Quote Originally Posted by Alfredo Medina View Post

    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.

  5. #5
    Forum Co-Founder Alfredo Medina's Avatar
    Join Date
    December 7, 2010
    Location
    Orlando, FL, USA
    Posts
    3,100
    Current Local Time
    01:49 PM
    Quote Originally Posted by Robert Roffe View Post
    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.
    Attached Files Attached Files

  6. #6
    Junior Member
    Join Date
    September 19, 2017
    Location
    Seattle, WA
    Posts
    43
    Current Local Time
    10:49 AM
    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.
    Attached Files Attached Files
    Last edited by Robert Roffe; December 27th, 2018 at 06:51 PM. Reason: See Alfredo's solution below

  7. #7
    Moderator Robin Deurloo's Avatar
    Join Date
    July 7, 2011
    Location
    Rotterdam, Holland
    Posts
    1,235
    Current Local Time
    07:49 PM
    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

  8. #8
    Forum Co-Founder Alfredo Medina's Avatar
    Join Date
    December 7, 2010
    Location
    Orlando, FL, USA
    Posts
    3,100
    Current Local Time
    01:49 PM
    Quote Originally Posted by Robin Deurloo View Post
    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.

  9. #9
    Mr. Revit OpEd
    Join Date
    December 14, 2010
    Posts
    2,882
    Current Local Time
    10:49 AM
    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.
    Last edited by Steve_Stafford; December 26th, 2018 at 10:06 PM. Reason: added a mention to the existing thread here
    cganiere likes this.

  10. #10
    Forum Co-Founder Alfredo Medina's Avatar
    Join Date
    December 7, 2010
    Location
    Orlando, FL, USA
    Posts
    3,100
    Current Local Time
    01:49 PM
    Quote Originally Posted by Alfredo Medina View Post
    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.

    Attached Thumbnails Attached Thumbnails visibilty formula issue with yes/no-2018-12-26_18-02-18.jpg  
    Attached Files Attached Files

Page 1 of 2 12 LastLast

Similar Threads

  1. Formula issue
    By GarethCavill in forum Architecture - Family Creation
    Replies: 3
    Last Post: August 14th, 2018, 10:20 AM
  2. Grid visibilty
    By Daithi101 in forum Tutorials, Tips & Tricks
    Replies: 1
    Last Post: August 20th, 2017, 01:42 PM
  3. Replies: 2
    Last Post: November 18th, 2016, 01:24 PM
  4. Formula issue
    By KK1975 in forum Architecture and General Revit Questions
    Replies: 9
    Last Post: October 17th, 2014, 06:36 AM
  5. Schedule formula (is there a formula expert in the house?)
    By John McCamont in forum Architecture and General Revit Questions
    Replies: 8
    Last Post: September 9th, 2011, 09:50 PM

Posting Permissions

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