XOR Gateway expression

Certified Senior Developer

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

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    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.

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    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)

  • 0
    Certified Lead Developer
    in reply to Kirang

    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.

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Hi Stefan,

    I have 2 scenarios.

    when I give service_name from the dropdown that value will be searched in my uploaded file.

    Scenario1:If the dropdown value matches the service name in the excel then it should go to next XOR gateway.

    scenario2: If the dropdown value does not matches with service name in the excel then it should go to send email node.

    For this question I am giving manual values to excel file uploaded. My dropdown points to CONT-ALOC value, this value is searched in my multiple type of pv!cdt.

    Why do you copy the data?

    This can be done using contains also, but just for testing I am putting it in a flag variable to check the value.

    hy the if()

    Kindly, tell me what should I write in the XOR condition.

  • 0
    Certified Lead Developer
    in reply to Kirang

    You have multiple values in your excel file. Does your logic apply to each individually, or to all at once?

    I was referring to your code snippet from above:

    1) What is the purpose of copying the data into a local using a foreach?

    2) contains() returns a boolean value. What is the purpose of the if()?

  • 0
    Certified Lead Developer
    in reply to Stefan Helzle
    2) contains() returns a boolean value. What is the purpose of the if()?

    In fairness, i find myself sometimes using this/similar style of mildly-redundant if() statement, if only to cement (even if for no other reason than readability later) what the positive and negative outcomes are intended to be.  But you're right that it's redundant and you're right that folks should learn the concepts behind how and why this is true.

Reply Children