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
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.
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)
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.
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.
Unknown said: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.
Unknown said:hy the if()
Kindly, tell me what should I write in the XOR condition.
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()?
Unknown said: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.
I agree, and I even use this in case I have to implement a more complex logic. When doing a code review, I accept this only in case of an explicit design decision.
(clicks nonexistent "like" button)
Here I am giving below condition,
if all pv!cdt match with dropdown value it should go to XOR,
if one value from pv!cdt is not matching with pv!cdt then it should go to Copy of send email.
How this can be achieved?
Unknown said:if all pv!cdt match with dropdown value it should go to XOR,
Well as I said below, contains() will match any entries.
For checking whether all entries match a given value, you can use a!forEach for an easy-to-understand alternate method:
and( a!forEach( pv!cdt.srvc_nm, fv!item = pv!Service_name ) )
In the above code snippet, the internal a!forEach() generates an array of boolean values i.e. {true(), false(), true()} etc; if all entries in the array match, these will all be true(), and thus the outer and() will also return true.
Mike ,Thanks for help.