Skip to main content
September 27, 2022
Question

XOR Gateway expression

  • September 27, 2022
  • 14 replies
  • 0 views

Hi,

I am taking the service name from drop down field from interface and mapping it to following variable.

After that I am uploading excel as below:

Following is the rule I am using in script task and saving its value into Boolean type variable 'flag'.

My requirement is if pv!Service_name=pv!cdt.srvc_nm then it should go to XOR path otherwise send email path.

 if I change the value in excel rows the flow is not going in appropriate way.

Thanks,

Kiran

    14 replies

    harshitb6843
    September 27, 2022
    Following is the rule I am using in script task and saving its value into Boolean type variable 'flag'

    TIP: In this code block, you can eliminate the if() condition as the contains() function will give you a boolean value itself. 

    Now to debug the problem, did you check if both the variables are populating correctly in the process details of the instance? If yes, then try to wrap the parameters of contains() function in touniformstring() and tostring() respectively. That should solve the problem. 

    September 27, 2022

    Hi Harshit,

    see this are my pv values. The flow should go to copy of send email but it is going to XOR as mentioned above

    stefanhelzle0001
    Brainy
    September 27, 2022

    Is there a specific reason for copying the data into a local variable using foreach()?

    In the data you shared, I see an "a" at the end of the first value. Could it be that there is a space before or after the second one? In cases like this, I recommend to first try to get working code in a separate expression. Once I understand the what is going on, I put it into process. This makes debugging way easier.

    September 27, 2022

    Hi Stefan, 

    its random value other than PV! service_name for which I am checking the condition.

    If PV! service name does not match with any value of pv!cdt.srvc_nm then the flag should be false and it should go to copy of send email otherwise it should go to next node(which is XOR)

    stefanhelzle0001
    Brainy
    September 27, 2022

    I fully understand what you are trying to do.

    1) Why do you copy the data?

    2) Why the if()

    And, when none of the values matches your string, then the XOR is working as expected. First, make sure that your logic works, then check your values and finally put it into the process.

    mikes0011
    Brainy
    September 27, 2022

    contains() will return true if ANY items in the array match.  thus your pv!flag will be set to TRUE, and the "XOR" path will be executed.

    The Expression Guru