Showing posts with label Extracting Value from XML. Show all posts
Showing posts with label Extracting Value from XML. Show all posts

Monday 28 September 2020

Extracting Multiple Nodes from Hierarchy - Working with XSL Transformation

 Hello All, 

Recently i was working on a integration where i was getting multiple errors in case of failures.

I was first planning to use FINS Industry XML service for the Error property extraction or Workflow Utility Echo, but these business services have limitations that they can only get one Node/Process Property from the hierarchy. i.e. return the first matching node in case multiple child are present at same level .

In the below XML if we try getting the Value of Error Code, using any Siebel provide vanilla business service ,we will only get "ErrorCode:500" and not the other nodes.







so, to get multiple Node we need to write custom Business Service that traverses the Hierarchy and do looing, that can be a bit confusing and requires multiple looping.

SiebelMessage.GetChild(0).GetChild(0).GetProperty("ErrorCode"); 

here, SiebelMessage.GetChild(0) is the IO instance

SiebelMessage.GetChild(0).GetChild(0) is the IC Instance

SiebelMessage.GetChild(0).GetChild(0).GetProperty("ErrorCode") is the location of process property we need to extract

XSL to the Rescue :-)

Well not a traditional approach, but yes we can use XSL for the multiple Node extraction, and that too without writing a custom BS. The code is pretty simple and can get to any level of hierarchy.

Below code Searches for ErrorCode and ErrorMessage under XMLResult/ErrorDetails path and uses for-each loop to iterate and get the values 





the final Result looks like, 

ErrorCode: 5002 ErrorMessage: The JSON value could not be converted to System 

ErrorCode: 5003 ErrorMessage: The Total value cannot be Negative. 

ErrorCode:5004 ErrorMessage: The Taxes must be passed in Input


I will share more details on how to use this in workflow in my next post, till then happy exploring

Friday 4 December 2015

How to Get value of XML node from IO/XML Hierarchy in Siebel workflows

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:

  1. Need a way to get the XML Hierchy/IO Hierarchy 
  2. Get the value of particular Node in XML/IO Hierarchy
  3. 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.

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...