VMware Cloud Community
sam_accenture
Contributor
Contributor
Jump to solution

How to use IF else condition in OGNL

i want to use if else statement in OGNL

scenario:

i have 3 input parameters .i have to run an action for 3rd input with help of input 1 and input 2.

i have to pass input 1 or input 2 to the action item which is added in input 3.

kindly help me with ONGL expression to get the desired output.

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Something like the following OGNL should work. In this particular example, it will call the action, passing the value of input1 if it is not null, otherwise passing the value of input2. Of course, you can change the condition to be something else, depending on your use case.

GetAction("com.foo.bar","myaction").call( (#input1 != null) ? #input1 : #input2 )

View solution in original post

2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Something like the following OGNL should work. In this particular example, it will call the action, passing the value of input1 if it is not null, otherwise passing the value of input2. Of course, you can change the condition to be something else, depending on your use case.

GetAction("com.foo.bar","myaction").call( (#input1 != null) ? #input1 : #input2 )

sam_accenture
Contributor
Contributor
Jump to solution

Thanks llian llive...It worked for me ..

Reply
0 Kudos