Hello All,
Recently i got a new requirement where in i have to get the value of a Node of Output XML Hierarchy and depending on some condition change the value of the node. ie. say, I have Queried on LOY Member IO and i got Output Member points, now i need to return money value of Member Points.
<ListOfMember>
<Member>
<Name>ABC</Name>
<Age>30</Age>
<Email>A@B.C</Email>
<Points>10000</Points>
.....
</Member>
</ListOfMember>
here i needed to return the Amount equivalent of points, ie, say 100 points equals 200 rupee so, for 1000 points it should return 2000 in Points, as customer is concerned only with the Money value of points in all not the actual point balance.
The approach is Prety simple:
Here i use a very common BS Workflow Utility to get and set the value of the Node.
1.Get the value of Node Points.
Business Service : Workflow Utilities
Method : Echo
Create a Process Property of type Hierarchy , name it say XML Output.
I my case i am first Querying data using EAI Siebel Adapter and Converting the IO output hierchy in XML hierarchy and Storing the output in XML Output.
Input Argument :
Output Argument :
The path is given in Dot notation till to node whose value we want to fetch.
as in this case it is XMLHierarchy.ListOfMember.Member.Points.<Value> , and we can store this value in any Process Property in my case Points.
2.Set the value of Node Points.
Business Service : Workflow Utilities
Method : Echo
In input pass the XMLHierarchy as input, and the value of node which is to be set you can ether use a literal value or any expression for that,
Input Argument :
Here i am setting the value the value of Node Points as Points*2 ,
Input Argument is :
XMLHierarchy.ListOfMember.Member.Points.<Value>
value is :
2*[&Points]
Output Argument :
here we are just returning the XML Output which will contain the XMLHierarchy with modified node value.
the output will be something like ,
<ListOfMember>
<Member>
<Name>ABC</Name>
<Age>30</Age>
<Email>A@B.C</Email>
<Points>20000</Points>
.....
</Member>
</ListOfMember>
you could also see the modified values in the watch window during simulation.
Hope this was helpful , cheers ...
I will also share how to Add a new node in the Output XML Hierarchy in case the requirement is to show the Calculated/New value as a new entry in XML in upcoming post.
Recently i got a new requirement where in i have to get the value of a Node of Output XML Hierarchy and depending on some condition change the value of the node. ie. say, I have Queried on LOY Member IO and i got Output Member points, now i need to return money value of Member Points.
<ListOfMember>
<Member>
<Name>ABC</Name>
<Age>30</Age>
<Email>A@B.C</Email>
<Points>10000</Points>
.....
</Member>
</ListOfMember>
here i needed to return the Amount equivalent of points, ie, say 100 points equals 200 rupee so, for 1000 points it should return 2000 in Points, as customer is concerned only with the Money value of points in all not the actual point balance.
The approach is Prety simple:
- Need a way to get the XML Hierchy/IO Hierarchy
- Get the value of particular Node in XML/IO Hierarchy
- Set the value of Node in the Hierarchy.
Here i use a very common BS Workflow Utility to get and set the value of the Node.
1.Get the value of Node Points.
Business Service : Workflow Utilities
Method : Echo
Create a Process Property of type Hierarchy , name it say XML Output.
I my case i am first Querying data using EAI Siebel Adapter and Converting the IO output hierchy in XML hierarchy and Storing the output in XML Output.
Input Argument :
Output Argument :
The path is given in Dot notation till to node whose value we want to fetch.
as in this case it is XMLHierarchy.ListOfMember.Member.Points.<Value> , and we can store this value in any Process Property in my case Points.
2.Set the value of Node Points.
Business Service : Workflow Utilities
Method : Echo
In input pass the XMLHierarchy as input, and the value of node which is to be set you can ether use a literal value or any expression for that,
Input Argument :
Here i am setting the value the value of Node Points as Points*2 ,
Input Argument is :
XMLHierarchy.ListOfMember.Member.Points.<Value>
value is :
2*[&Points]
Output Argument :
here we are just returning the XML Output which will contain the XMLHierarchy with modified node value.
the output will be something like ,
<ListOfMember>
<Member>
<Name>ABC</Name>
<Age>30</Age>
<Email>A@B.C</Email>
<Points>20000</Points>
.....
</Member>
</ListOfMember>
you could also see the modified values in the watch window during simulation.
Hope this was helpful , cheers ...
I will also share how to Add a new node in the Output XML Hierarchy in case the requirement is to show the Calculated/New value as a new entry in XML in upcoming post.
Will it work for multiple nodes?
ReplyDelete