IT Process Automation

 View Only
  • 1.  PAM Operator custom result port expression

    Posted Aug 19, 2019 04:00 PM
    ​Hi All

    I have a javascript operator with two custom result ports that should direct the process based on values coming out of the operator.

    I am testing for two values (10345 or 10322) and if one of them is NOT one of the values go one way and if one of the values is equal go the other. 

    Expression on Port A

    ((Process.OfferingID__ != "10345") || (Process.OfferingID__ == "10322))  if neither of these take this path.


    Expression on Port B

    ((Process.OfferingID__ == "10345") || (Process.OfferingID__ == "10322))  if either of these take this path.


    If the OfferingID = 10345 going into the operator the process moves out on Port B

    If the OfferingID = 10322 going into the operator the process moves out on Port A, if I change the position of the test values swapping 10322 with 10345 in the expression for port B and send it 10322 the process moves out on port B.

    Its like its not evaluating anything after the || (or).

    Thanks

    Terry


  • 2.  RE: PAM Operator custom result port expression
    Best Answer

    Posted Aug 20, 2019 09:55 AM
    Edited by Diane Craddock Aug 21, 2019 11:12 AM
    Greetings!

    So a couple of things. First, this line

    ((Process.OfferingID__ != "10345") || (Process.OfferingID__ == "10322))

    you are missing a double quote after 10322. Next, the way that statement reads is "If the process ID is not 10345 or is 10322", meaning it will always go that path since if it is 10322, it meets the second criteria, and if it isn't, it meets the first one.

    For your second one, a general rule of thumb is if you are looking to make sure something does not equal certain values you want an and, and if you want it to equal one of multiple values you want an or.

    So if I am reading your requirements correctly you'd likely want:

    (Process.OfferingID__ == "10345" || Process.OfferingID__ == "10322")

    If the value is one of these two, do this, otherwise, move on.