Skip to main content

Dear participator,

 

How can i  make Nested If else condition using Rules.

 

I have checked everything but i didn't see where i can achieved the Nested IF Else condition.

 

Kindly Suggest me...

 

Depending on what you're doing Advanced Conditions may work.  Otherwise you can get the functionality of nested if conditions by having your IF condition call an Unbound rule which has its own IF or Advanced Conditions.

 

Here is a blog that talks about using Unbound Rules:  https://simonatk2.wordpress.com/2015/09/08/giving-views-the-power-in-k2-smartforms/

 

Hope this helps.

Tim


Thank you for your suggestion..

 

 

I have already done  as same way. but i think this is not a good practice for development, how many unbound rule we will have to created to a  single logical condition..

 

is there any simple way as other programming.

 


Within the Smartform designer I don't know of any other effective way of doing it.   I'd love to hear if anyone else has any other suggestions.

 

If you have a who lot of conditions it may make sense to externalize those to a web service, stored procedure or even a .Net assembly that you could wrap in a smartobject and then call that smartobject passing in any parameter(s) and it reurns the results of your nested if conditions.


Hi SalmanZubairy,

 

             Yes you can write nested if else condition in rule. You can do this by adding if condition in else part. For every else if condition use else condition and then if condition  and at last use else .

 

Refer below attached  screen. where I am using Nested if else ladder to check first name and show a message, if condition matched or  else show message  which is inside the  "else condition".

 

  .

 

let me know if it helps.


hey Karan,

 

Thank you for your suggestion,

 

But its not helpful to me, because i need more then one IF Else Condition inside the Valid condition.

 

in your scenario only one condition will be executed. so i need more then one condition in side the true condition.

 

Thank you


Hi, Karan Varma,

 

Thanks to give your suggestion, i respect your answer but, this solution already i have implemented and as you can see my  previous reply i mention that execute another rule in IF Else i don't think so this is good practice for developer, because you suggest me 2 level if else i have more then two nested if else so in that case how many rule i ll have to create, i think this is not a good practice,

 

it mean there is no nested if else condition available,

I think K2 team should think about this scenario.


 

Yes and you can raise this concern with K2 Team also. But as of now I think you may have to proceed with either expressions or  any one of the above solutions. 


Reply