IPA Branch Node - Condition Expression Builder

 6 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
Margie Gyurisin
Veteran Member
Posts: 538
Veteran Member

    I am trying to send a form to employees when they change either their address1 or their city and live in PA.  I do not want the form to be sent if they’ve only changed their phone number.

    I have this formula in the Condition Expression Builder but it is sending the form even when it is only a phone number change.

     

    (qEMP_PROCESS_LEVEL==30 &&qEMP_STATE =="PA" &&oldAddr1!=qEMP_ADDR1) || (qEMP_PROCESS_LEVEL==30 &&qEMP_STATE =="PA" &&oldCity!=qEMP_CITY)

     

     

    Does anyone know how I can make this happen?  Do I have to create a separate branch node and then a separate e-mail node when the address line 1 changes and another when the city changes?

    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      Complex expressions in a Branch aren't always effective. I would suggest that you create a Boolean variable (sendEmail=false) and default it to false. Then I would use an Assign node JavaScript function (Add JavaScript) to check your conditions

      if (qEMP_PROCESS_LEVEL==30 && qEMP_STATE =="PA" && oldAddr1!=qEMP_ADDR1) sendEmail=true
      if (qEMP_PROCESS_LEVEL==30 && qEMP_STATE =="PA" && oldCity!=qEMP_CITY) sendEmail=true

      And then your Branch condition would simply be sendEmail (if it is true based upon your JS function then the notice will be sent).
      David Williams
      John Henley
      Posts: 3353
        You might also look at the actual values in oldCity vs. qEMP_CITY vs. oldAddr1 vs. qEMP_ADDR1; if one of them has trailing spaces and the other doesn't, JavaScript will treat that as a difference, so you might need to right-trim them as part of the comparison...
        Thanks for using the LawsonGuru.com forums!
        John
        Woozy
        Veteran Member
        Posts: 709
        Veteran Member
          I'd also suggest trimming the new and old Address and City variables within your expressions - I'd be willing to bet one side or the other (new or old) has trailing spaces.

          Using IPA I haven't really had any issues with complex expressions in branches, but that may be an issue with PFI. I'm not sure which you are using.
          Kelly Meade
          J. R. Simplot Company
          Boise, ID
          John Henley
          Posts: 3353
            Gee Woozy, great minds do think alike!
            Thanks for using the LawsonGuru.com forums!
            John
            Kyle Jorgensen
            Veteran Member
            Posts: 122
            Veteran Member
              Try this:

              (qEMP_PROCESS_LEVEL == 30 && qEMP_STATE == "PA" && ((trimTrailingSpaces(oldAddr1)).toUpperCase()!= (trimTrailingSpaces(qEMP_ADDR1)).toUpperCase() || (trimTrailingSpaces(oldCity)).toUpperCase() != (trimTrailingSpaces(qEMP_CITY)).toUpperCase()))
              Kyle Jorgensen
              Veteran Member
              Posts: 122
              Veteran Member
                Oh, BTW, PROCESS_LEVEL is an alphanumeric field. Even it you're using numbers as your process levels, they'll need quotes around them when they're evaluated.