Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Business Processes and Rules: Siebel eBusiness Application Integration Volume IV > Data Mapping Using Scripts >
Map Functions
A map function has the following signature:
function MapFnName (objectIn, objectOut)
The function name signified by MapFnName is the name of your transformation function. It is the value passed as the MapName argument to the business service. The Input Type and Output Type business service arguments determine the types of the objectIn and objectOut arguments and default to the type Integration Message. You should name these arguments according to type. For example, to use the default values, you would specify a function that transforms one integration object to another as:
function
MapFnName
(intMsgIn, intMsgOut)If you define a function that transforms an XML property set to an integration object, you might specify it as:
function
MapFnName
(xmlPropSetIn, intMsgOut)The arguments to these functions are contained within the input and output arguments to the business service's Service_PreInvokeMethod function. The EAIExecuteMap function—called by Service_PreInvokeMethod—interprets the arguments and passes them to MapFnName. MapFnName reads from the input object and writes to the output object using the appropriate API for each type of object.
If you define a function to access input integration object, you might specify it as:
Function myMapFn (ObjectIn, ObjectOut) {
inIntObj = ObjectIn.GetIntObj(); //Get Integration Object
//Iterate over all Integration Object Instances
while (inIntObj.NextInstance()) {
//Get the Primary Component which is called
"Order Entry - Orders"
primaryIntComp = inIntObj.GetPrimaryIntComp(
"
Order Entry - Orders"
);//Iterate over all instances of Primary Component
while (primaryIntComp.NextRecord()) {
OrderId = primaryIntComp.GetFieldValue (
"
Id"
);//Get component
"
Order Entry - Line Items"
which is child of "Order Entry - Orders"comp = primaryIntComp.GetIntComp (
"
Order Entry - Line Items"
);//Process component similar to primary component
while (comp.NextRecord()) {
OrderItemId = comp. GetFieldValue (
"
Id"
);And to define a function to create output integration object, you might specify it as:
Function myMapFn (ObjectIn, ObjectOut) {
outIntObj = ObjectOut.CreateIntObj(
"
Sample Order"
);While (Need new integration object instances) {
outIntObj.NewInstance();
//Create Primary Component which is called
"
Order Entry - Orders"
primaryIntComp = inIntObj.CreatePrimaryIntComp(
"
Order Entry - Orders"
);while (Need new instances of primary int component) {
primaryIntComp.NewRecord();
primaryIntComp.SetFieldValue (
"
Id"
, OrdertemId);//Create component Order Item which is child of Order
comp = primaryIntComp.CreateIntComp (
"
Order Entry - Order Items"
);//Process component similar to primary component
while (need new instances of component) {
comp.NewRecord();
comp. SetFieldValue (
"
Id"
, OrdertemId);EAIExecuteMap() Method
This method executes a user-defined data transformation function. Table 13 presents the parameters for this method.
Syntax
EAIExecuteMap(methodName, inputPropSet, outputPropSet)
Returns
CancelOperation or ContinueOperation. The Service_PreInvokeMethod function should return the value returned by the EAIExecuteMap.
Usage
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Business Processes and Rules: Siebel eBusiness Application Integration Volume IV Published: 18 April 2003 |