on 2019 Jul 25 1:02 PM
experts - hello
Im tryin to solve this problem. Source message look like this:
<Root>
<Name>Mike</Name>
<Status>Active</Status>
<Location>
<Country>US</Country>
<isLocal>no</isLocal>
<isGlobal>no</isGlobal>
</Location>
<Location>
<Country>UK</Country>
<isLocal>no</isLocal>
<isGlobal>yes</isGlobal>
</Location>
</Root>
And then this is logic need to be followed
if (Status = "Active")
if (count(location) > 1) //has more than 1<Location>
if (isGlobal = "yes")
isGlobal is "yes"
else
isGlobal is "no"
if (isLocal = "yes")
isLocal is "yes"
else if (isLocal = "no" & count(/Root/Location[isLocal = 'yes']) = "0") //there is no <isLocal> = 'yes' in all <Location>
isLocal is "yes"
else
isLocal is "no"
else //has only 1 <Location>
if (isGlobal = "yes" & isLocal = "no")
isGlobal is "yes"
isLocal is "yes"
else if (isGlobal = "yes" & isLocal = "yes")
isGlobal is "yes"
isLocal is "yes"
else if (isGlobal = "no" & isLocal = "no")
isGlobal is "no"
isLocal is "no"
else
isGlobal and isLocal are both ""
Based on logic, expected output is this:
<Root>
<Name>Mike</Name>
<Status>Active</Status>
<Location>
<Country>US</Country>
<isLocal>yes</isLocal>
<isGlobal>no</isGlobal>
</Location>
<Location>
<Country>UK</Country>
<isLocal>yes</isLocal>
<isGlobal>yes</isGlobal>
</Location>
</Root>
I tried graphical mapping but the ifS only returns 1 value. Can anyone give idea how to solve? And thank you in advance!!
Hi Mike,
you can put the result of one >If<
element into the >than< or >else< of another. There is also the alternative
to map either with Groovy (or in Java since Groovy is build on top of Java) or
XSLT.
Regards
Saraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.