4 Replies Latest reply on Jan 21, 2015 6:53 AM by art_l

    Too Many Parameters....another solution?

    art_l

      Title

      Too Many Parameters....another solution?

      Post

      I am working on an equation that has too many parameters and need a fresh look.  Anyone suggest another way? Here is the gist of what I am trying to do:

      1f [(BoxA > 80 and BoxB< 90) AND If (ContainerA >120 and ContainerB<150);"Perfect";"not Perfect"]

      I need to to get a range between two different groups to get a result.  I tried the IF statement above and get a TOO MANY PARAMETERS error.  I also need to nest 4 of these If statements in the equation to accommodate different ranges and results.

      Is there another way?

      ==== EDITED ABOVE... should look like this======

       

      1f [(BoxA > 80 and BoxA< 90) AND If (ContainerA >120 and ContainerA<150);"Perfect";"not Perfect"]

        • 1. Re: Too Many Parameters....another solution?
          philmodjunk

          Your syntax error is because you are missing some right parenthesis in your expression. But you do not need the second If function in the example given.

          Case ( BoxA > 80 and BoxB< 90 And ContainerA > 120 And ContainerB < 150 ; "Perfect" ; "Not Perfect" )

          But your expression looks unusual. Are you sure that you actually have 4 different fields to test here and not just two?

          • 2. Re: Too Many Parameters....another solution?
            art_l

            I have 4 sets of ranges to test.

            Ex.

            BoxA >90 and BoxA<110 AND ContainerA>150 and ContainerA<180

            BoxA >110 and BoxA<120 AND ContainerA>180 and ContainerA<190

            Etc, each with different TEXT results.

            Yikes, you are correct, just TWO, not 4... Brain Fart

            Sorry about that.

            • 3. Re: Too Many Parameters....another solution?
              philmodjunk

              Would that be two different results or 4?

              Case ( BoxA >90 and BoxA<110 AND ContainerA>150 and ContainerA<180 ; "Result 1" ;
                         BoxA >110 and BoxA<120 AND ContainerA>180 and ContainerA<190 ; "Result 2" ;
                         "Result 3" // This is the "else" result returned when none of the two Boolean expressions are True
                        )

              Case functions start with the first Boolean expression and returns the corresponding result of the first one to evaluate as True

              PS, you probably need some < operators here as the values BoxA = 110 and ContainerA = 180 will produce "Result 3" if you don't use them here.

              • 4. Re: Too Many Parameters....another solution?
                art_l

                Forgot all about CASE function.  Yes, this works perfect, thanks!  As always, greatly appreciate your help.

                You are correct about < in the above example.


                Thanks, tested a sample of the code and it works. Should have thought of this myself.

                PS: to answer your question, for every line of code, you get one result. in your example, the return would be 2 results. Result 3 would return a false result as you noted above.  Correct as you interpreted it. Thanks.