23 Replies Latest reply on Jul 20, 2012 5:01 AM by Ozer Mustafa Onar

    Boolean problem with conditions

    Brian Dalton

      I've been trying to figure out how to construct the conditions I need for a particular transition and as near as I can tell it's not possible to do what I want.  I drew a diagram to illustrate what I need:

       

      Boolean Puzzle.jpg

      I want to have several pairs of values ANDed then set up an OR for all of the results, which should require placing AND containers inside an OR container, but I don't see how that is possible in EPDM.  I can place multiple ORs into an AND, but not the other way around.

       

      I hope that I'm wrong and that someone can show me how to create the boolean structure I'm looking for, otherwise I may have to break this out into multiple parallel transitions.  That would be possible, but I've got some 12 - 15 pairs of criteria to work with so I'd need that many individual transitions...

        • Re: Boolean problem with conditions
          Michael Dekoning

          Brian,

           

          I think this will give you the desired results.

           

          Conditions.PNG

          Mike

          EPDM 2011 SP2

            • Re: Boolean problem with conditions
              Brian Dalton

              Michael, my understanding is that putting two conditions inside an OR container causes them to be ORed together, and that placing multiple OR containers into a condition causes those ORs to be ANDed.  That would mean that you have created the opposite of what I need; a set of ORs being ANDed together.  What I'm hoping for is a set of ANDs that can be ORed together, as my (crude) diagram is intended to show.

                • Re: Boolean problem with conditions
                  Michael Dekoning

                  Brian,

                   

                  Yes, you are right. Sorry, that was too easy to be right. I guess we've always used multiple transitions. If I think of something else I'll post back.

                   

                  Mike

                  EPDM2011 SP2

                  • Re: Boolean problem with conditions
                    Jason Capriotti

                    Maybe you could explain what you want it to do> I think the ORs in transitions is confusing.....and it works different than the almost identical interface for doing a custom search.

                     

                    Here's our approval transtion which require severals departments to sign off before it moves to our Inbox state. We have 3 OR conditions each with their own ANDs. The first requires the signoff variable from each department to be complete. The second requires all but one if a cost variable is less than a certain amount. The last requires only two if the filename has a ".RC." in it.

                     

                    Is this not similar to what you want?

                     

                    And Or Approvals.jpg

                      • Re: Boolean problem with conditions
                        Brian Dalton

                        Jason, I'm not sure if I'm reading you correctly, but it seems that you may be misunderstanding how the OR container works (or maybe it's me that's confused?).

                         

                        As I understand it, when you create an OR container, all conditions that you place inside of it are combined using the OR operator.  When you insert several OR containers the results of those ORs are then combined in the final step using the AND operator.

                         

                        That would mean that you have ORed together 7 conditions, then ORed together another 7 conditions, then ORed together 2 conditions, then finally you have ANDed the results of those three ORs.

                         

                        That's three blocks of ORed conditions feeding into one AND; exactly the opposite of what I'm looking for.  I need several blocks of ANDed conditions that are then ORed together.

                         

                        If I'm misunderstanding the way that the OR container works, please enlighten me... I find the descriptions in the documentation to be typically vague and ambiguous.

                          • Re: Boolean problem with conditions
                            Jason Capriotti

                            I think we're both confused....maybe you can describe in more detail what you're trying to do.

                             

                            As I understand it, the OR container is doing what I would call an AND. On my first OR container, CADApproval must be "NO" AND EngChiefApproval must be "NO" AND etc. Everything under the OR must be true to move it to the next state.

                             

                            The second and third ORs contains other AND conditions that are allowed.

                             

                            All three make up the top level OR.

                             

                            Now my head hurts.

                    • Re: Boolean problem with conditions
                      M. B.

                      Wouldn't nested if/and/or functions do this in an Excel design table?

                      • Re: Boolean problem with conditions
                        Tim Read

                        Hello Brian,

                         

                        How about trying this.

                         

                        Three parallel transistions with the same name each with the separate "AND" conditions.

                         

                        The transistions become the "OR" condition.

                         

                        Tim

                          • Re: Boolean problem with conditions
                            Brian Dalton

                            Hi, Tim.

                             

                            This is what I mentioned at the end of my initial post, only I would need 15 or more parallel transitions in order to achieve what I want, which would be very cumbersome indeed.  I may ultimately have no option, however..

                              • Re: Boolean problem with conditions
                                Wayne Matus

                                There use to be an issue with having too many parallel transitions between two states in a workflow. I do not know if the issue still exists or what the limit was. What happens behind the scenes is a SQL query is built. If some limit in that query is exceed, you will not be able to save your workflow changes.

                                  • Re: Boolean problem with conditions
                                    Brian Dalton

                                    Thanks for the heads-up, Wayne.  This sounds like another good reason for expanding the capalities of structuring conditions by adding an AND container in addition to the existing OR container.  If these containers are allowed to be nested within one another, there would effectively be no limit to what logic could be programmed into a single condition set.

                                     

                                    I would love to submit an enhancement request about this, but I don't seem to have access through my subscription account to do SERs.  I've contacted my VAR about getting this issue resolved so that my voice can be heard!

                                     

                                    B-

                              • Re: Boolean problem with conditions
                                Wayne Matus

                                You should be able to do this by defining three catagories, one for each AND condition. Then in your transition you have your OR condition. OR CatagoryA, CatagoryB, CatagoryC.

                                 

                                If you do not understand, I can create an image of what I am talking about.

                                • Re: Boolean problem with conditions
                                  Jonathan Gamble

                                  Brian,

                                    I just came across your question, and I realize it is almost 8 months later, but I noticed that no one really gave you an answer, so I will have a go.  I came across exactly the same problem setting up our design change approval process.  Our process allows for different required signatures depending on the nature of the change.  e.g. if it results in a change to the form fit and function of an end product, then sales must sign off, otherwise they don't etc.  So for each of the 4 possible signatures, there is a check box to indicate if that signature is required.  The Change Request form sits in the "Waiting for Approvals" state until all the required signatures have been received.  Each time someone signs off, a decision has to be made i.e. are more signatures required?  If so, the form must return to the "Waiting for Approvals" state.  The logic for this decision is identical to your boolean diagram: IF (Engineering_Signature_Required AND Engineering_Signature="") OR (Sales_Signature_Required AND Sales_Signature="") etc...

                                    The problem (as you already figured out) is that this cannot be implemented directly.  In logic terms, the solution is to invert the boolean logic and use DeMorgan's Rules to put it in a form that can be implemented in Enterprise  If you take this same case and rather than working out if the document needs more signatures, instead, work out if it doesn't, you get: IF(Engineering_Signature_NOT_Required OR Engineering_Signature!="") AND (Sales_Signature_NOT_Required OR  Sales_Signature!="") etc....  As you can see, this results in a sequence of OR conditions, ANDed together.  To implement this, the documents automatically transition back to the "Waiting for Approvals" state after each sign of, whether they need to or not.  We then use another automatic transition from this state with the conditions described, to send the Change Request to the "Approved State" if no more signatures are required.  The documents end up being sent back to the "Waiting for Approvals" state one time more than they logically need to, but this is a small price to pay to be able to implement the logic!

                                    One last comment: I cannot take credit for this solution, it was given to us some time ago by Justin Webster and Jake Smith at InFlow Technologies when they set the system up for us.  It was only recently, now that I have moved on and am setting up Enterprise for my new employer, that I realized what they had done matches what you are trying to do.  So thank you Jake and Justin!  I hope you don't mind me spreading the word!

                                  • Re: Boolean problem with conditions
                                    Adam Bodell

                                    I pulled this from the 2012 EPDM admin guide, pg. 436

                                     

                                    Conditions.PNG

                                      • Re: Boolean problem with conditions
                                        Jonathan Gamble

                                        Adam,

                                          The problem with the 'OR container' is that you end up with an expression like:

                                        (A OR B) AND (C OR D)

                                         

                                        Brian's original problem required an expression like:

                                        (A AND B) OR (C AND D)

                                         

                                        The solution I ended up using was to invert the logic, so that instead of defining the condition for making a transition, you define the condition for NOT making the transition.  Of course, you also have to change the workflow.  But inverting the logic allows you to manipulate the condition expression.  So you get:

                                        NOT{(A AND B) OR (C AND D)} =  (NOT{A} OR NOT{B}) AND (NOT{C} OR NOT{D})

                                         

                                        As you can see, the result is in a form that can be implemented using EPDM 'OR containers'

                                         

                                        Hope this makes sense!

                                      • Re: Boolean problem with conditions
                                        Ozer Mustafa Onar

                                        Maybe, parallel transition option that will come with EPDM2013 could be your solution.