MONUMETRIC Video mmt-volt

Collapse

if() statement that evaluates to 4 states

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrBIMtastic
    Senior Member
    • August 2, 2012
    • 151
    • Phoenix, AZ

    if() statement that evaluates to 4 states

    I don't think this is possible. But, I figured i could be wrong (yet again.)

    Desired outputs for Param C based on different conditions:
    A=Yes and B=1 should produce C= "Good Choice"
    A=No and B=1 should produce C= ""
    A=Yes and B=2 should produce C="Do Not Use"
    A=No and B=2 should produce C=""

    I can almost get this to work by adding another parameter.
    D= if(B=1,"Good Choice","")
    C= if(and(A, B=1),D,"Do Not Use"

    I just can't get the last state.
    The problem is, an if() statement can only have 2 values. So, when B=1, the if() can read D but when B=2 Param C always reports "Do Not Use" regardless of the State of A.

    Ideas?
    Last edited by MrBIMtastic; May 19, 2014, 06:48 PM. Reason: Posted before finished
    Apparently BigBadBIM was taken, so MrBIMtastic it is.
    http://whosafraidofthebigbadbim.blogspot.com
  • jmk
    Forum Addict
    • December 31, 2012
    • 1665
    • NM, USA

    #2
    Assuming that A is a yes/no, B is an integer and C is a text type parameter you should be able to do it with nested if statements.

    if(and(A, B=1), "Good Choice", if(and(A, B=2), "Do Not Use", '' ''))

    if(and(<condition 1>, <condition 2>), <true>, if(and(<condition 1>, <condition 2>), <true>, <false>))

    With the nested if statements there is a single false that is shared by multiple if statements.
    Julie Kidder
    Architect + BIM Director
    Hartman + Majewski Design Group

    Comment

    • kowen1208
      Senior Member
      • January 18, 2013
      • 352
      • Utah

      #3
      Here's how I'd do it, assuming the values for B of 1 and 2 are the only values that would result in a string of text:

      if(A,if(B=1,"Good Choice","Do Not Use"),"")
      Last edited by kowen1208; May 19, 2014, 08:24 PM. Reason: changed assumption
      Owen Drafting Technologies
      Kyle Owen - Owner

      Comment

      • MrBIMtastic
        Senior Member
        • August 2, 2012
        • 151
        • Phoenix, AZ

        #4
        jmk,

        Let me try that. Note, I posted before I was ready and my edits may change what you were thinking...
        Apparently BigBadBIM was taken, so MrBIMtastic it is.
        http://whosafraidofthebigbadbim.blogspot.com

        Comment

        • MrBIMtastic
          Senior Member
          • August 2, 2012
          • 151
          • Phoenix, AZ

          #5
          jmk,

          Worked great and didn't need the helper parameter. The only think I changed was to make the B=2 in the second if be not(B=1) so that B can have values other than 1 and 2.

          if(and(A, B = 1), "Good Choice", if(and (A, not(B =1)),"Do Not Use", ""))

          I think I got hung up by not allowing the "" to be the default value....

          Thanks again.
          Apparently BigBadBIM was taken, so MrBIMtastic it is.
          http://whosafraidofthebigbadbim.blogspot.com

          Comment

          • MrBIMtastic
            Senior Member
            • August 2, 2012
            • 151
            • Phoenix, AZ

            #6
            kowen 1208

            This formula didn't work. I think it's because you need a value before the second if() statement. Or maybe I'm hung up on B only be allowed to be 1 or 2.
            Last edited by MrBIMtastic; May 19, 2014, 08:18 PM.
            Apparently BigBadBIM was taken, so MrBIMtastic it is.
            http://whosafraidofthebigbadbim.blogspot.com

            Comment

            • kowen1208
              Senior Member
              • January 18, 2013
              • 352
              • Utah

              #7
              Originally posted by MrBIMtastic
              kowen 1208

              This formula didn't work. I think it's because you need a value before the second if() statement. Or maybe I'm hung up on B only be allowed to be 1 or 2.
              Worked for me copying it from this thread into Revit.

              (This is using Yes/No param for A, Integer param for B, and Text param for C.)
              Owen Drafting Technologies
              Kyle Owen - Owner

              Comment

              • MrBIMtastic
                Senior Member
                • August 2, 2012
                • 151
                • Phoenix, AZ

                #8
                Nope, you're right. works fine. It was me changing the scope of things on the fly. Having B be more than 1 or 2 was a requirement, or I would have used a Yes/No parameter.
                Apparently BigBadBIM was taken, so MrBIMtastic it is.
                http://whosafraidofthebigbadbim.blogspot.com

                Comment

                • jmk
                  Forum Addict
                  • December 31, 2012
                  • 1665
                  • NM, USA

                  #9
                  Glad you got one working, I wasn't sure what you wanted integers other than 1 or 2 to report, so I'm glad you modified it to make it work.
                  Julie Kidder
                  Architect + BIM Director
                  Hartman + Majewski Design Group

                  Comment

                  • kowen1208
                    Senior Member
                    • January 18, 2013
                    • 352
                    • Utah

                    #10
                    Originally posted by MrBIMtastic
                    Nope, you're right. works fine. It was me changing the scope of things on the fly. Having B be more than 1 or 2 was a requirement, or I would have used a Yes/No parameter.
                    I can understand that; I worded it wrong in my first post, but I fixed it.
                    Owen Drafting Technologies
                    Kyle Owen - Owner

                    Comment

                    Related Topics

                    Collapse

                    Working...