i have a oozie workflow im using decision control node in the predicate i want to "&&" two different conditions and i need to use "&&" in between them for the final TRUE/FALSE result
i dont find the predicate syntax for such conditions
im using this
<decision name="comboDecision">
<switch>
<case to="alpha">
---------
</case>
</switch>
</decision>
i want to do this =
<decision name="comboDecision">
<switch>
<case to="alpha">
condition1 && condition2
</case>
</switch>
</decision>
can anyone help me with the syntax ?
I will explain this with an example.
Let's assume that we have a Java action (we will call this action as getAgeInfo
), which outputs age of a person:
'person.age': Age of the person
The action:
<action name='getAgeInfo'>
<!--Outputs 1 property: person.age: returns age of the person-->
<java>
..........
</java>
<ok to="makeClassification" />
<error to="fail" />
</action>
The next action is makeClassification
.
In makeClassification
action, we classify a person into "child", "teenager", "mid-aged" or "senior-citizen", based on the person's age.
For e.g. if a person's age is greater than or equal to (ge) 12 (and) less than (lt) 20, we classify that person as a teenager and the workflow transitions to teenager
action.
Following is the switch statement, which illustrates use of "and":
<decision name="makeClassification">
<switch>
<case to="child">
${wf:actionData('getAgeInfo')['person.age'] gt 0 &&
wf:actionData('getAgeInfo')['person.age'] lt 12}
</case>
<case to="teenager">
${wf:actionData('getAgeInfo')['person.age'] ge 12 &&
wf:actionData('getAgeInfo')['person.age'] lt 20}
</case>
<case to="mid-aged">
${wf:actionData('getAgeInfo')['person.age'] ge 20 &&
wf:actionData('getAgeInfo')['person.age'] lt 50}
</case>
<case to="senior-citizen">
${wf:actionData('getAgeInfo')['person.age'] ge 50}
</case>
<default to="error"/>
</switch>
</decision>
You can see another example here: Oozie by Example, which illustrates the use of gt (greater than), lt (less than), logical or (||), logical and (&&).