0 Replies Latest reply on Sep 27, 2007 4:56 AM by ramsub

    Decision expressions.

    ramsub

      Hi,
      I'm using jbpm 3.1.3,
      I have a context variable that is a list, and I need to have a decision condition that evaluates by calling the contains() method on this list.

      I'm trying :
      <decision name="decision1" expression='#{MYLIST.contains("A") ? "a" : "b"}' >

      However, this does not seem to work and throws an exception saying :
      Caused by: org.jbpm.JbpmException: couldn't evaluate expression '#{MYLIST.contains("A") ? "a" : "b"}'
      at org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:38)
      at org.jbpm.graph.node.Decision.execute(Decision.java:108)
      ... 57 more
      Caused by: org.jbpm.jpdl.el.ELException: Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||", "?"]


      Has anyone done this before ? Can the contains method be called inside an expression ? If not, are there any ways out ( i do not want to write a decision handler)

      Also, can i use a script inside a decision handler to take a decision, and how can i do that ?
      That is, can I say :

      <script>
      <variable name='MYLIST' access='read' />
      <expression>
       if(MYLIST.contains("A")) {
       executionContext.leaveNode("a"); } else
       if(MYLIST.contains("B")) {
       executionContext.leaveNode("b"); } else {
       executionContext.leaveNode("Other"); }
       </expression>
      </script>
      

      inside a decision handler ? even this does not seem to work for me