0 Replies Latest reply on Oct 9, 2013 4:45 AM by Jos de Bruijn

    using if statement in expressions

    Jos de Bruijn Newbie

      I'm new to jBPM and I'm trying to figure out how to use expressions.

      Lets say i've got the following process:

      <?xml version="1.0" encoding="utf-8"?>
      <process name="StartCondities" xmlns="http://jbpm.org/4.4/jpdl" >
      
      
        <start name="Start" g="21,161,48,48" >
          <transition name="SequenceFlow_1" to="start_condition"/>
        </start>
      
      
        <decision name="start_condition" expr="#{content}" g="146,161,48,48" >
          <transition name="low" to="Level_1"/>
          <transition name="normal" to="Level_2" g="171,70:"/>
          <transition name="high" to="Level_3" g="171,325:"/>
        </decision>
      
      
        <task name="Level_1" assignee="a" g="330,30,100,80" >
          <transition name="SequenceFlow_3" to="End" g="505,70;505,185:"/>
        </task>
      
      
        <task name="Level_2" assignee="a" g="330,145,100,80" >
          <transition name="SequenceFlow_2" to="End"/>
        </task>
      
      
        <task name="Level_3" g="330,285,100,80" >
          <transition name="SequenceFlow_4" to="End" g="501,325;501,185:"/>
        </task>
      
      
        <end name="End" ends="processinstance" g="545,161,48,48" />
      
      
      </process>
      

      I know how to start the process using a single variable to immediatly go to the correct task, by using content='normal'

      But I'm want to make the expression a little bit more complex.

      I'm giving 2 variables at start of the process (I know how to do this)

      type='bug'

      priority='high'

      Can I make the expression something like this:
      IF (type='bug' AND priority='high') THEN transition 'high'

      ELSE IF (type='question' AND priority='normal') THEN transition 'low'

      ELSE transition 'normal'