Complex Record Mapping using Java of Carl Ozkaynak

Hi Carl ,
I realy impresed with the code in archive but i have problem in implementing the same. as i saw there is some code missing.

Not able get that please can clarify me urgently

Next, using a standard Java for-loop, get the value of orderItemsList key “Stock”. Remember that a cursor is required to navigate the IData object.

for (int i=0; i ???
IDataCursor idcItem = orderItemsList[i].getCursor();

idcItem.first(“Stock”);
String stock = (String)idcItem.getValue();

i saw in two place same thing missing .

Please need it urgently.

with regards
satya

Hi Satya,

Wow. Thank you for pointing this out. It looks like there must have been an error of some sort when converting to the new look & feel of wmusers site. The full code was here before.

Here is the code you were looking for:

IData orderList = (IData)ValuesEmulator.get(pipeline, “Order”);

IData newOrderList = (IData)ValuesEmulator.get(orderList, “NewOrder”);

IData bulkOrderList = (IData)ValuesEmulator.get(newOrderList, “BulkOrder”);

IData orderInformationList = (IData)ValuesEmulator.get(bulkOrderList, “OrderInformation”);

// Retrieve the necessary elements the OrderInformation structure
IDataCursor idc = orderInformationList.getCursor();

idc.first(“CustomerName”);

String custName = (String)idc.getValue();

idc.first(“OrganizationType”);

String organizationType = (String)idc.getValue();

idc.destroy();

// Retrieve the elements from the line
IData orderItemsList = (IData)ValuesEmulator.get(orderInformationList, “OrderItem”);

for (int i=0; i<orderItemsList.length; i++) {

   IDataCursor idcItem = orderItemsList[i].getCursor(); 
   idcItem.first("Stock"); 
   String stock = (String)idcItem.getValue(); 

   idcItem.first("Price"); 
   String price = (String)idcItem.getValue(); 

   idcItem.first("Side"); 
   String side = (String)idcItem.getValue(); 

   if (stock.equals("IBM") && organizationType.equals("XYZ")) { 
          // Set the value if the transformation rule is true. 
          // copy the new valuen into the specified field 
          idcItem.first("CUSIP"); 
          idcItem.setValue("12345"); 
   } 


   if (stock.equals("NRWR") && organizationType.equals("ABC")) { 
       
          // Set the value if the transformation rule is true. 
          // copy the new valuen into the specified field 
          idcItem.first("SEDOL"); 
          idcItem.setValue("67891"); 
   } 

}

idcItem.destroy();

Hope this helps!

Thanks!

Best Regards,
Carl