Siebel

Everything you want to know about Siebel !!!

Depth First Search of a Type in Property Set

Scenario: You want to search for a PropertySet in a Hierarchial Data set.

Usual approach: Read the Data set and find out the level of child and then use GetChild(i) function to go to that level.

e.g., var SiebMsg; //Hierarchial Data Set

The structure of the PropertySet SiebMsg looks something like this:
——————————

———————
Start Process Thu Nov 01 22:24:57 2007
Siebel Message in CreateInPS()
PROVIDED PROPERTY SET
Type: Value:
CHILD PROPERTY SET 0
Type: XMLHierarchy Value:
CHILD PROPERTY SET 0
Type: SiebelMessage Value:
MessageId = 3-GFSQS
MessageType = Integration Object
IntObjectName = CC EAI WDS Voluntary Disconnect Request
IntObjectFormat = Siebel Hierarchical
CHILD PROPERTY SET 0
Type: ListOfCcEaiWdsVoluntaryDisconnectRequest Value:
CHILD PROPERTY SET 0
Type: OrderEntry-Orders Value:
CHILD PROPERTY SET 0
Type: Id Value: 3-87VW09
CHILD PROPERTY SET 1
Type: Account Value: 8046900013722350
CHILD PROPERTY SET 2
Type: CCCSGDisconnectDate Value: 04/25/2006 00:00:00
CHILD PROPERTY SET 3
Type: CCCSGOrderType Value: CH
CHILD PROPERTY SET 4
Type: CCCSGReasonCode Value: SB – Siebel
————————Done with PropertySet—————————
Note: This is just an example. Your Siebel Message could look something different with different data. Refer to your sample of data for more processing…

e.g., I need to create a PropertySet from the above Siebel Message which would contain all the child elements of element with Type = “OrderEntry-Orders” as given above.
Typical approach is the following:
If I call the above msg as my input ps then the following we do:

var OrderLvl = Inputs.GetChild(0).GetChild(0).GetChild(0).GetChild(0);

//You can observe the Child levels and their enumeration values “0″ beginning from element with Type = “” i.e. NULL.
Then you can do your processing to retrieve Child elements of “OrderEntry-Orders” type.

There is a problem with the above approach. What if the incoming data set order changes. Your code would fail since you have hard coded the level of OrderEntry-Orders which is served as a reference point for your future processing.

Instead use a method which would work irrespective of data order change in your input. The method does a depth first search of a required / searched type and returns the order.
The method is given below.

The above syntax where we declared and defined a variable to set the order level would look like:

var OrderLvl = findpsType(Inputs, “OrderEntry-Orders”); //This method will retrieve the OrderLvl value correctly even if the order level has changed.

findpsType(ps,type);
var psTemp = null;
var psType = ps.GetType();
if (psType == type) // found
psTemp = ps;
else // try each child until found…
for (
var i = 0,
n = ps.GetChildCount();
i < n && !(psTemp = zzz_psFindChild(ps.GetChild(i)
, type));
i++
);
return(psTemp);

July 18, 2008 - Posted by Narayan Patro | Scripting | | No Comments Yet

No comments yet.

Leave a comment