cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get process variables in conditionExpression?

al_lv
Champ in-the-making
Champ in-the-making
Hello forum,

my process should run a certain path dependent on a value of one process variable.
How can I implemet this with exclusive gateway and conditionExpression?

I didn't fount no example in UserGuide… Smiley Sad

Kind regards.

Alexej
6 REPLIES 6

frederikherema1
Star Contributor
Star Contributor
Below an extract from the userguide, showing 3 different flows out of the gateway, which depend on process-variable 'input'


<exclusiveGateway id="exclusiveGw" name="Exclusive Gateway" />
   
<sequenceFlow id="flow2" sourceRef="exclusiveGw" targetRef="theTask1">
  <conditionExpression xsi:type="tFormalExpression">${input == 1}</conditionExpression>
</sequenceFlow>
   
<sequenceFlow id="flow3" sourceRef="exclusiveGw" targetRef="theTask2">
  <conditionExpression xsi:type="tFormalExpression">${input == 2}</conditionExpression>
</sequenceFlow>
   
<sequenceFlow id="flow4" sourceRef="exclusiveGw" targetRef="theTask3">
  <conditionExpression xsi:type="tFormalExpression">${input == 3}</conditionExpression>
</sequenceFlow>

al_lv
Champ in-the-making
Champ in-the-making
oh! sorry, I was satisfied $input variable sould be defined in the process_defintion.bpmn20.xml and not programmatically on the start of the process.

I will try this way.

Another question:
can I use Strings in conditionExpressio like this:${transition == "siebel"} or should it be integer as in the example?


Thanks

frederikherema1
Star Contributor
Star Contributor
You can use string, thats no problem. Might have to do ${stringVar.equals('myValue')}, not sure what the UEL-spec says…

mghb2009
Champ in-the-making
Champ in-the-making
how get input value without service task?
${input == 3}

sunilkumartk
Champ on-the-rise
Champ on-the-rise
I am doing my first wf in activiti 5.19 I have the following Exclusive gateway. I need to use a string compare in my expression.
But i am not able to make it work.
heres what i have in the gateway
<blockcode>
    <exclusiveGateway id="TechnicalApprovalStatusCheck" name="Technical Approval Status Check"></exclusiveGateway>
    <sequenceFlow id="techapproval" name="Technical Approved" sourceRef="TechnicalApprovalStatusCheck" targetRef="businessValidation"></sequenceFlow>
    <sequenceFlow id="techReject" name="Technical Rejection" sourceRef="TechnicalApprovalStatusCheck" targetRef="RequestToolCompleted">
    <sequenceFlow id="techOnhold" name="Technical On Hold" sourceRef="TechnicalApprovalStatusCheck" targetRef="technicalValidation">
      <conditionExpression xsi:type="tFormalExpression">${stageCount == 2}></conditionExpression>
    </sequenceFlow>
      <conditionExpression xsi:type="tFormalExpression">${state.equals('rejected')}</conditionExpression>
    </sequenceFlow>
</blockcode>

Irrespective what i try in the process variable use the execution takes me to the task 'businessValidation'.
What am i doing wrong ?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Sunil,

jUnit test would help (https://forums.activiti.org/content/sticky-how-write-unit-test), but I would say that the first sequence flow which is evaluated to the true is taken. (in your case businessValidation). Use default flow or condition.

Regards
Martin