Hello All,
Siebel property set are indispensable when it comes to format data in hierarchical formats. Recently I had some requirement wherein I had to return output in hierarchical format.
The exact requirements was we have queried multiple SR's and return the result in a hierarchy.
The exact requirements was we have queried multiple SR's and return the result in a hierarchy.
so to format data i used Property Sets to convert output data in required format
Format 1:
| PropertySet [ <?xml version="1.0" encoding="UTF-8"?> <?Siebel-Property-Set EscapeNames="true"?> <PropertySet> <SR1> <SRNumber>1-23245</SRNumber> <Status>Closed</Status> <Error></Error> </SR1> <SR2> <SRNumber>1-456386</SRNumber> <Status>Open</Status> <Error></Error> </SR2> </PropertySet>] |
in this format Attributes appear as Separate Tags under parent SR tag.
Format 2:
| PropertySet [ <?xml version="1.0" encoding="UTF-8"?> <?Siebel-Property-Set EscapeNames="true"?> <PropertySet> <SR1 SRNumber="1-23245" Status="Closed" Error=""></SR1> <SR2 SRNumber="1-23245" Status="Closed" Error=""></SR2> </PropertySet>] |
in this format Attributes appear witin parent SR tag.
Depending on the requirement below code can be used to format the output.
Sample Code for Format 1:
| for(var x = 1; x <= NumberOfSR; x++) { var outPropset = TheApplication().NewPropertySet() ; var outPropset1 = TheApplication().NewPropertySet() ; var outPropset2 = TheApplication().NewPropertySet() ; var outPropset3 = TheApplication().NewPropertySet() ; // oOutputs contains values of Multiple SR's, SR = oOutputs.GetProperty('SR '+x); var pInputs = TheApplication().NewPropertySet(); var pOutputs = TheApplication().NewPropertySet(); pInputs.SetProperty("ProcessName", "Process SR Workflow"); pInputs.SetProperty("Object Id", SR); pService.InvokeMethod("RunProcess", pInputs, pOutputs); var SR = oOutputs.GetProperty("SRNumber"); var Status = oOutputs.GetProperty("Status LIC"); var Error = oOutputs.GetProperty("Error Code"); outPropset.SetType('SR'+x) ; outPropset1.SetType("SRNumber") ; outPropset2.SetType("Status"); outPropset3.SetType("Error"); outPropset1.SetValue(SR) ; outPropset2.SetValue(Status) ; outPropset3.SetValue(Error) ; outPropset.AddChild(outPropset1) ; outPropset.AddChild(outPropset2) ; outPropset.AddChild(outPropset3) ; Outputs.AddChild(outPropset); } // After looping if you want to convert Property set to XML use XML Converter Business Service |
Sample Code for Format 2:
| // Declaration same as above { outPropset.SetType('SR'+x) ; outPropset.SetProperty("SRNumber", SR); outPropset.SetProperty("Status", Status); outPropset.SetProperty("Error", Error); Outputs.AddChild(outPropset); } // After looping if you want to convert Property set to XML use XML Converter Business Service |
various methods that can be used with Property sets are.
- AddChild
- SetType
- SetProperty
- GetProperty
- SetValue
for more details please refer bookshelf https://docs.oracle.com/cd/E14004_01/books/OIRef/Siebel_eScript_Quick_Reference11.html