Many times we came across situation where we have a singleton variable and we need to assign value to this based on If-Else.
We can write this logic quite easily if we have an XSL or we can have if else activity in SOA/ Gateway in BPM.
We will show you a simple logic to have if-else in Assign activity
Explanation:
Syntax:
concat(substring(<value to be assigned>,1 div (<your if condition>)),substring(<value to be assigned>,1 div not (<same condition written for first substring>)))
First part marked in Red:
The if condition is evaluated with 1 divided by the expression.If this is true then the value mentioned is assigned (It can be a string or can be a variable).
Second Part marked in Green:
In this case the expression is evaluated with not condition.This is similar to else statement.If the expression is evaluated to true then value mentioned is assigned.
e.g.:
concat(substring("true",1 div (contains($successFlag,"SUCCESS"))),substring("false",1 div not(contains($successFlag,"SUCCESS"))))
If the variable successFlag contains value Success then the expression will be evaluated as true and then true will be assigned to the variable.If the successFlag contains any other value then 1 div not expression will be true and false will be assigned to variable.
please let us know if code is needed for the same.
Cheers,
LetsLearnOracleFusionTeam
We can write this logic quite easily if we have an XSL or we can have if else activity in SOA/ Gateway in BPM.
We will show you a simple logic to have if-else in Assign activity
Explanation:
Syntax:
concat(substring(<value to be assigned>,1 div (<your if condition>)),substring(<value to be assigned>,1 div not (<same condition written for first substring>)))
First part marked in Red:
The if condition is evaluated with 1 divided by the expression.If this is true then the value mentioned is assigned (It can be a string or can be a variable).
Second Part marked in Green:
In this case the expression is evaluated with not condition.This is similar to else statement.If the expression is evaluated to true then value mentioned is assigned.
e.g.:
concat(substring("true",1 div (contains($successFlag,"SUCCESS"))),substring("false",1 div not(contains($successFlag,"SUCCESS"))))
If the variable successFlag contains value Success then the expression will be evaluated as true and then true will be assigned to the variable.If the successFlag contains any other value then 1 div not expression will be true and false will be assigned to variable.
please let us know if code is needed for the same.
Cheers,
LetsLearnOracleFusionTeam