cancel
Showing results for 
Search instead for 
Did you mean: 

AND or OR, That is the Question

vadim_tabakman
Nintex Newbie
8 6 5,408

This is where Nintex Workflow meets Shakespeare.  Ok maybe not.

But seriously, wow what a release the June 2015 is turning out to be.  Are you ready to start building complex workflow? No????  That's ok... the aim of this post is not to be complicated, but to actually reduce the size of your workflows.  That's because with the addition of the AND and OR functionality, where you previously had nested Conditional Branches, Loops or Run Ifs, now you can configure the multiple conditions into the single action.

This is what the workflow could have potentially looked like before :

BeforeWorkflow.png

Now that's not too bad, but imagine a big workflow and then it gets quite hard to maintain

So with this release, the above workflow design, changes to this:

AfterWorkflow.png

Isn't that a huge change?  Not only will it reduce the size of the workflow, but it will mean that modifying it and maintaining it over time will so much easier.

But what would it now look like inside the action?

MultipleConditionspng.png

Notice how we can add other conditions by simply clicking on the Add condition link.

The new, dynamic ability to add AND/OR conditions into actions is available in the following actions:

  • Conditional Branch
  • Loop
  • Run If

Take the following workflow as an example:

WorkflowDesign.png

Now that is a cropped version of a workflow I was building around an expense claim.  Part of that is a number of Conditional Branches and also a Loop action.  Now, the Conditional Branches have a number of conditions and the Loop has about 4 conditions.  Imagine having to build that out with the ability to have the multiple conditions in these actions.

This is what I was getting at, in that we're not talking about complexity.  In fact, we're actually streamlining the workflow design.  Building Nintex Workflows gets better and better.

I've attached the workflow to this post.  It's not a real workflow, in that, it's not usable in it's current state.  But will show you some ideas behind this new AND/OR logic.

Adding and Removing Conditions

Now that you know you can have multiple conditions, how do you do it?

Each of the actions mentioned above come with an extra link in the configuration window of the action.  It's named Add a Condition  Simply click on that, and it will give you an extra section for a condition.  Click it again, and you get another section.  It's a little like adding rows dynamically to a Repeating Section in Nintex Forms.

HowToAddaCondition.png

What you will also get with each new section, is ability to remove it if you need to.  There is a Red X in each section and by clicking on that, it removes that section, but leaves the rest intact.

HowToDeleteaCondition.png

Beware though, it doesn't give you a confirmation popup asking if you're sure you want to delete that section, it simply deletes it.  But if you think about it, why do you need a confirmation, since you can just cancel out of the action configuration window, open it again and the sections will be there.

To Use AND or OR, or just AND, or just OR, or OR and OR???

Is that the question? Is that actually a question?  What am I talking about here?

The interesting thing about having the ability to build AND/OR conditions, is that it's quite easy to get lost in your own head when you're putting together the condition.  What I recommend, is that you take a look at the Nintex Office 365 Help topic on "Logic operators" as it'll help you figure out the order or precedence for the AND/OR functionality.

The other thing I recommend, is keep it simple first. Build some simple conditions and run those workflows.  Set some tasks for yourself to get your head around. Once you get it, it'll be so much easier.

If you have any questions or comments, please post them at the bottom of this post.

6 Comments
kristig
Nintex Newbie

Yeah, thank you!!!!

s_devalk
Nintex Newbie

Do the AND clauses have a stronger 'bind' than OR clauses, as parenthases are not available in the action? for example:

'a AND b OR c AND d' evaluates to TRUE if c and d are TRUE?

'a OR b AND c OR d' evaluates to FALSE if b and c are FALSE?

vadim_tabakman
Nintex Newbie

Hi Sjoerd,

check out the Help for this : AND/OR Help

It has great examples of how the AND/OR logic precedence works.

cheers,

Vadim

sharepointsean
Nintex Newbie

Hi Vadim,

I have just found this article and it would suit what I am trying to do perfectly.

I have noticed that the ZIP file that you attached is a .NWP file. Is this the file extension for Nintex workflow for Office 365?

If it is, would you be able to convert the workflow to a .NWF file so that I can import it into our current Nintex deployment and have a good look at the workflow.

Than you very much Vadim.

Sean Docherty

emha
Nintex Newbie

is there a way how to reorganize/resort single condition?

I need to put new condition into middle of existing logic and can't find a way how to do that. I wouldn't like to build an action from the scratch...

johnfriday13
Nintex Newbie

hi there,

 

I have some "not/or/and" rules for hiding questions on a form until the correct sequence is completed and I am trying to change this sequence of rules to show that if any of (question 9, 10 and 11 ) = Yes, then show Question 12, otherwise show the next question eg. if Question9 is no, then show Question10 and if Question10 is no then show Question11. 

 

so my original sequence which worked when all the questions were sequential and were set to answer 'yes' is shown below.

 

Not(and(equals(Question8,'Yes'),and(equals(Question7,'Yes'),and(equals(Question6,'Yes'),and(equals(Question5,'Yes'),and(equals(Question4,'Yes'),and(equals(Question3,'Yes'),and(equals(Question2,'Yes'),equals(Question1,'Yes'))))))))

 

in order to achieve the right outcome, I modified the sequence this way:

 

 Not(and(or(equals(Question9,'Yes'),equals(Question10,'Yes'),equals(Question11,'Yes'))), and(equals(Question8,'Yes'),and(equals(Question7,'Yes'),and(equals(Question6,'Yes'),and(equals(Question5,'Yes'),and(equals(Question4,'Yes'),and(equals(Question3,'Yes'),and(equals(Question2,'Yes'),equals(Question1,'Yes')))))))))

 

thinking i could just include an 'and(or(,,,)' statement to capture that at least one of the 'or' conditions be filled in addition to the existing criteria. 

 

but it's not working and i'm not sure what i have missed.