How to read xml element if condition met

Hi there,

I have done with my workflow to read the xml element if condition met. Here are both my xml file and xaml file. test.xml (1.9 KB) test2.xaml (9.9 KB)

I want to use writeline activities to output my biz : ABC Enterprise. But my execution keep failed with empty writeline. Does anyone can help me to look through my workflow? Is there any error or missing part need to modify it?
I could appreciate much on your assistance.

Thanks and best regards.

In code you are assigning

wgn=xml_Out.Element(“tiqCsr”).Elements(“pf”).Elements(“wg”).Elements(“wgn”).First

first means it will select CTBG, but you used condition wgn.contains(“MMBA”).

It will be false so you are not getting any out value.

image

If you remove first then assign to an array then it will have CTBG,MMBA. After that you can use foreach followed by condition

3 Likes

Hi @Sreelatha278

I had removed First and assigned it to ToArray. But there’s an error occurred if I put the variables as XElement and so I put it as IEnumerable. But, there’s another error occurred when I use If activity to check whether the nodes contain “MMBA” or not. How am I going to fix these error?

Capture

Thanks and best regards.

@yushinchan try this one

test2 (1).xaml (12.1 KB)

Hi, it’s work :') But may I know how to output Capture this in my output panel?
Cuz I found that it’s doesn’t work using .Value.ToString.

I haven’t found that value in the given input xml file.

Hi, that’s my dummy xml file in fact. But there’s a value like this in my original xml file. How am I going to output this kind of value?

If the conditions satisfy it will print the output.

share the xml file

the expected output value is in “pfv” tag?

Hi,

Here the xml file. test.xml (1.9 KB)
*the value at the last node.

Yup, it’s in “pfv” tag.

In xaml file we are filtering based on below condition
wgn = MMBA
pfd= “*Business/Employer’s Company Name”

but ABCD123 is having pfd as Customer Due Diligence so the pfd condition failed and it wont give it in the output

Hi,

I had assigned pfd as condition with Customer Due Diligence but still the desired output doesn’t appear.

Did you got any error.

from my side it is working and displaying as output

No clue why it is failing for you.

Nope, no any error. But just that the output panel is blank.

This is my workflow.

Capture

p/s: condition name based on my original xml file.

And here is the output panel showing cdd.

Capture1