How to build complex expressions in K2 Five

  • 31 August 2021
  • 8 replies
  • 190 views

Hi Team,

 

Can someone please help to understand how we can build the complex line rules of K2 4.7 in K2 Five.

The AND operator is used between condition 1 and condition 2. However, condition 2 is having many sub/group conditions with AND, Or, Not etc. along with the Data fields. Tried with set variable etc but unable to achieve it. Not sure if need to get a smartobject created or custom .net code wriiten.

 

Kindly, suggest on it.

 

Regards,

Supriya


8 replies

Hi,


 


Can someone please help me with my question.


 

When referring to 4.7 I gather that you used the Thick Client designers (K2 Studio / VS). I think in the HTML Designer you can achieve the desired results using Decision steps with customer rules.


 


https://help.nintex.com/en-US/k2five/userguide/Current/default.htm#K2-Workflow-Designer/Use/Toolbox/Logic/Decision/Decision.htm


 


HTH


Vernon


  

Hi Vernon, 


 


But within decision step, how to achieve conditions with multiple AND, OR, group conditions etc.


Data fields are used.


 


For example:


Isvalid = True
And
(City = 'LV' And Not IsPass And Not IsFail) Or (City = 'AL' And Not IsPass And IsFail) Or ((City = 'NW' And IsPass And Not IsFail) And Not IsDuplicate)


 


Kindly, let me know in case of any question.


 


Thanks and Regards,


Supriya Funde

Userlevel 2
Badge +10

Hi fsupriya3,


 


Perhaps a different approach to this is to break down the expression into smaller subsets. First, I would have a IsValid path decision. From there, it can go to each destination (i.e. City is LV, City is NW, etc..)


 



 

Hi Khanh,


 


Thanks for your response.


However, if a K2 4.7 activity have multiple outcomes with different condition on each line rule in that case I think this implementation with K2 Five will not be feasible because as per my knowledge so many decisions will not help to achieve the requirement. Also, it will be difficult to compare the complete result of a single query with True or false.


I am thinking if I can achieve that logic on Split by creating the variable. There are approx. 6-7 criteria's which are using such type of conditions.


Attached, one of the actual condition and there are many more which uses same type of conditions including data fields with different criteria's.


 


Could you please suggest.


 


Thanks and Regards,


Supriya Funde


 

Hi Khanh,


 


Kindly, suggest on this.


 


Regards,


Supriya

Hey @fsupriya3 ,


I've never used 4.7 but on 5.5 we are able to do AND, OR, and GROUPINGS within the decision node. In order to achieve this, drag and drop the "condition" node at the bottom of the decision designer on top of the existing "IF" statement. After doing this, it will create a grouped AND condition within the IF statement. You should be able to do this as much as you want.


 



 


Hopefully this helps.


 


Peter


 

Userlevel 3
Badge +9

If your data is stored in a database then I would suggest you use a Stored Procedure to determine the status and return a simplified value back to the WF and make the routing decisions based on that.


 


That is one complicated expression - the logic of it should probably be revisited and simplified where possible. E.g. make a partial assessment of some conditions then move on to another evaluation step and take other routes based on other parts of the data used in that expression.


 


Cheers

Reply