11 Replies Latest reply on Sep 19, 2014 5:40 AM by salaboy21

    JBPM variable

    kojot

      Hello
      I download two variables from database, and I want compare them. For example if variable "stop" is equal variable "count2" go to 1task, else go 2task.
      How to do it using the gateway?

        • 1. Re: JBPM variable
          swiderski.maciej

          depending if you use eclpise molder or web designer:

          - eclipse - double click on gateway to specify conditions on out going sequence flows

          - web designer - select outgoing sequence flow and then specify condition via properties panel on right hand side

           

          HTH

          1 of 1 people found this helpful
          • 2. Re: JBPM variable
            kojot

            I use web designer.
            In condition expression, just type in if(variable1 == variable2)?

            • 3. Re: JBPM variable
              salaboy21

              In the web designer if I don't remember wrong you need to select Java expression and then add something like:

               

              return (variable1 == variable2);

               

              of course that it depends on the type of the variables.. if variable1 and variable2 are ints that will work.

               

              Regards

              • 4. Re: JBPM variable
                kojot

                I have 2 integer variable, "count2" and "stop".
                in the first outgoing sequence flow i have return(count2 == stop)

                in the second outgoing sequence flow i have return(count2 != stop)

                and not working.

                 

                 

                My problem is, that the process always passes through "in the second outgoing sequence flow", despite that count2=5 and stop=5

                • 5. Re: JBPM variable
                  salaboy21

                  can you paste the error so we can see what is going on?

                  If you don't elaborate more and share that is going on it is too difficult to help you.

                  • 6. Re: JBPM variable
                    kojot

                    My problem is, that the process always passes through "in the second outgoing sequence flow", despite that count2=5 and stop=5

                    • 7. Re: JBPM variable
                      salaboy21
                      • 8. Re: JBPM variable
                        kojot

                        01.jpg

                        variables definition

                        02.jpg

                        mapping values from the database

                        03.jpg

                        mapping values from the database

                        04.jpg

                        condition "yes"

                        06.jpg

                        condition "no"

                        and always process go path "no", despite that count2 = 5 and stop = 5

                        • 9. Re: JBPM variable
                          salaboy21

                          Hi Patryk

                          Don't expect jBPM do something different than java in this case.

                           

                          If you create an unit test with this:

                           

                          Integer integer1 = new Integer(5);

                                  Integer integer2 = new Integer(5);

                                  Assert.assertTrue(integer1 == integer2);

                           

                          It will fail for sure.. because the two Integers are objects..

                          That's why I've asked if you have "int"s and not Integers

                           

                          If you change your return statements to use the equals method it should work:

                          Assert.assertTrue(integer1.equals(integer2));

                          • 10. Re: JBPM variable
                            kojot

                            I used "return count2.equals(stop);" and work good.
                            Thank you very much, Mauricio!

                            • 11. Re: JBPM variable
                              salaboy21

                              Yes, please don't forget that jBPM is pure java.. so follow the same rules than java for handling and comparing variables.

                              Regards