3 Replies Latest reply on Mar 28, 2006 8:21 AM by dhartford

    Decision node & expressions - this is not working

    dhartford

      hey all,

      Trying to get the following to work:

       <task-node name="getinfo">
       <task name="getinfo" swimlane="swimlane1">
       <controller>
       <variable name="decinfo" access="read,write,required" mapped-name="Please enter 'I', 'E', or 'C'"/>
       </controller>
       </task>
       <transition name="fdfsfds" to="myfirstdecnode"></transition>
       </task-node>
       <decision name="myfirstdecnode">
       <transition name="tr1" to="itask">
       <condition>decinfo=="I"</condition>
       </transition>
       <transition name="tr2" to="etask">
       <condition>decinfo=="E"</condition>
       </transition>
       <transition name="tr3" to="ctask">
       <condition>
      executionContext.getVariable("decinfo").toString().equalsIgnoreCase("C")
       </condition>
       </transition>
       </decision>
      


      Why would this not correctly move to the right task and instead always run the first transition (assuming the itask/etask/ctask were there, which they are an abbreviated for the post)?

      I've tried two different expression types, but neither seem to work, please help.

      very confused,
      -D

        • 1. Re: Decision node & expressions - this is not working
          dhartford

          Sorry, jbpm-3.1 starter kit.

          • 2. Re: Decision node & expressions - this is not working
            saviola

            Hi dhartford (How do you pronounce this name :()!
            I would suggest you give more sensible mapped name to the variable you are using in the condition expression and use this name instead.
            Also try using contextInstance object for accessing the variable instead of executionContext.

            <task-node name="getinfo">
             <task name="getinfo" swimlane="swimlane1">
             <controller>
             <variable name="decinfo" access="read,write,required" mapped-name="decisionVariable"/>
             </controller>
             </task>
             <transition name="fdfsfds" to="myfirstdecnode"></transition>
             </task-node>
             <decision name="myfirstdecnode">
             <transition name="tr1" to="itask">
             <condition>decisionVariable == 'I'</condition>
             </transition>
             <transition name="tr2" to="etask">
             <condition>decisionVariable == 'E'</condition>
             </transition>
             <transition name="tr3" to="ctask">
             <condition>
             contextInstance.getVariable("decisionVariable").toString().equalsIgnoreCase("C")
             </condition>
             </transition>
             </decision>


            By the way do you know that you can use variable to define which is the next transition you want to take:

            <transition name="to tn1" to="tn1">
             <condition expression="#{contextInstance.variables['Bla'] eq 'alabalAportokala'}"/>
             </transition>


            I suppose you have already set the variable like this for example:

            <event type="node-leave">
             <script>
             <variable name="Initiator" mapped-name="Bla"/>
             <expression>
             executionContext.setVariable("Bla", "alabalAportokala");
             </expression>
             </script>
             </event>


            I hope this could be usefull.

            Regards, Saviola


            • 3. Re: Decision node & expressions - this is not working
              dhartford

              Hi Saviola,
              Thanks, using the expression="" format (JSP EL?) worked when the other expressions did not. I may have been using older examples.

              I use the mapped-name more as a label (i.e. webapp), so that may be part of my previous problem.

              -D