1 Reply Latest reply on Feb 20, 2006 8:42 AM by mennen

    weird behaviour of setVariable: worked only once!

    mennen

      I have just tried the following code (in my process definition) to set the date to the current date. And it worked only once or twice!! It actually changed the variable field in the database with the expected value.

      <start-state name="start automatic_date">
       <task swimlane="demandeur">
       <controller>
       <variable name="myDate"/>
       </controller>
       <event type="task-create"> 
       <script>
       <expression> 
       Date today = new Date();
       executionContext.getContextInstance().setVariable("myDate",today.toString());
       </expression>
       </script> </event> </task>
       <transition name="" to="task1"> </transition>
       </start-state>
      
      
       <task-node name="task1">
       <task swimlane="demandeur">
       <controller>
       <variable name="myDate"/>
       </controller>
       </task>
       <transition name="" to="end1"></transition>
       </task-node>
      
      <end-state name="end1"></end-state>
      






      The problem is: it doesn't want to work anymore, and i don't know what the reason is !!!
      I checked to see if my code was right, and i saw an example of use of setVariable in http://www.jboss.com/index.html?module=bb&op=viewtopic&t=73364

      The process works fine, but the variable 's value is still null. I can't figure out what went wrong !! I redeployed the whole webapp, and dropped the database and started it all over again.

      I tried with another setVariable, the one in the link above:
      executionContext.getContextInstance().setVariable("stv", new Integer(11));

      And it only changed the LONGVALUE_ field value to 11.. but doesn't want to appear on the webconsole. (the STRINGVALUE_ field is empty)

      Thanks in advance,