8 Replies Latest reply on May 10, 2006 5:13 AM by Sidd Shetty

    Using Decision Successfully....

    Sidd Shetty Newbie

      Hi,

      i have trying to use the decision node wherein if the entered value is "less" it goes to a task node and does something or if its "greater" , it goes to a different one....

      This is the code

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.1" name="Trial">
       <swimlane name="checker">
       <assignment expression="user(grover)"></assignment>
       </swimlane>
       <swimlane name="lessthan">
       <assignment expression="user(ernie)"></assignment>
       </swimlane>
       <swimlane name="greaterthan">
       <assignment expression="user(bert)"></assignment>
       </swimlane>
       <start-state name="start">
       <task name="Send Item">
       <controller>
       <variable name="tracking number" access="read,write,required"></variable>
       </controller>
       </task>
       <transition name="Go" to="EnterAmt"></transition>
       </start-state>
       <task-node name="EnterAmt">
       <task name="SubmitAmt" swimlane="checker">
       <controller>
       <variable name="Amount" access="read,write,required" mapped-name="decisionVariable"/>
       </controller>
       </task>
       <transition name="CheckAmt" to="VerifyAmt"></transition>
       </task-node>
       <decision name="VerifyAmt">
       <transition name="Less" to="File LessThan">
       <condition>decisionVariable == 'less' </condition>
       </transition>
       <transition name="Greater" to="File GreaterThan">
       <condition>decisionVariable == 'greater' </condition>
       </transition>
       </decision>
       <task-node name="File LessThan">
       <task name="CreateLess" swimlane="lessthan" ></task>
       <event type="node-leave">
       <action name="create file" class="savefile.SaveFile"></action>
       </event>
       <transition to="join1"></transition>
       </task-node>
       <task-node name="File GreaterThan">
       <task name="CreateGreater" swimlane="greaterthan"></task>
       <event type="node-leave">
       <action name="create file2" class="savefile2.SaveFile2"></action>
       </event>
       <transition to="join1"></transition>
       </task-node>
       <join name="join1">
       <transition to="Finish"></transition>
       </join>
       <end-state name="Finish"></end-state>
       </process-definition>
      


      Is my code wrong becoz I have been trying everything which is given in the guide and also thru all the posts in this forum like using

      <condition expression="#contextInstance.variables['decisionVariable'] eq 'greater'"/>
      
      or
      
      <condition>
      contextInstance.getVariable("decisionVariable").toString().equalsIgnoreCase("greater")
       </condition>
      


      But still its not working and irrespective of the values entered it goes to the first task ie "File LessThan" .......am not getting any errors as such....Any pointers to this....

      I am using ::
      jbpm-starters-kit-3.1
      Java 1.4.3
      WinXP

      Thanks and Regards
      Sidd