7 Replies Latest reply on Aug 17, 2009 7:18 AM by kukeltje

    expression question

      Hello,

      I have this expression on my task:

      
      <decision name="Collateral" expression='#{ collateral == "true" }'>
       <transition to="fork1" name="true"></transition>
       <transition to="NO_COLLATERAL" name="false"></transition>
       </decision>
      
      


      final Map<String, Serializable> param = new HashMap<String, Serializable>();
      final String collavalue = "true";
      param.put("collateral", collavalue);
      


      my problem is the expression always falls to 'false' transition. How can make it work? And also if anyone can give me a different expression handling or tutorials, just for future references. :)

      Thanks a lot.
      Cheers.



        • 1. Re: expression question
          kukeltje

          The expressions are 'EL' (JUEL) so any tutorial you can find about that is applicable here.

          The expression should return the NAME of the transition to take. Not a boolean.

          Booleans are needed it you put conditions ON the transitions

          • 2. Re: expression question

            Hello,

            I change my expression to:

            
             <decision name="Collateral" expression='#{ collateral > 0 }'>
             <transition to="fork1" name="true"></transition>
             <transition to="NO_COLLATERAL" name="false"></transition>
             </decision>
            
            final Map<String, Serializable> param = new HashMap<String, Serializable>();
            param.put("collateral", new Integer(1));
            
            


            and it work fine. Now I am just confused that i cannot use string comparisson in expression? please advice.

            Thanks a lot.
            Cheers.




            • 3. Re: expression question
              chebancabpm

               

              "freak182" wrote:
              Hello,

              I change my expression to:

              
               <decision name="Collateral" expression='#{ collateral > 0 }'>
               <transition to="fork1" name="true"></transition>
               <transition to="NO_COLLATERAL" name="false"></transition>
               </decision>
              
              final Map<String, Serializable> param = new HashMap<String, Serializable>();
              param.put("collateral", new Integer(1));
              
              


              and it work fine. Now I am just confused that i cannot use string comparisson in expression? please advice.

              Thanks a lot.
              Cheers.




              Hello,
              in my opinion this syntax is more readable:

              
               <decision name="Collateral" expression='#{ collateral == "true" ? "true" : "false" }'>
               <transition to="fork1" name="true"></transition>
               <transition to="NO_COLLATERAL" name="false"></transition>
               </decision>
              
              


              The expression-based decisions must return a transition name.




              • 4. Re: expression question

                Hello,

                I also already try that one but no luck. :)

                Thanks.

                • 5. Re: expression question
                  kukeltje

                  what version are you using?

                  • 6. Re: expression question

                    Hello,

                    using v 3.2.x

                    • 7. Re: expression question
                      kukeltje

                      Can you try with the latest 3.2.6SP1? Not that you should use that, I'm just curious if it works as it should with the latest 3.2 version (it does for me)

                      Or try change the names of the transitions to not use 'true' and 'false' but e.g. 'to_fork1' and 'to_no_collateral'