Real Time Information Director User Documentation

RTID Metadata Language
Hewlett-Packard Company 46 529618-002
SAP dates are usually expressed as eight consecutive digits. A formatter inserts
hyphens between the year, month, and day for an SQL date field, e.g., 20030630
is converted to 2003-06-30.
This type of conversion occurs automatically. You needn’t specify it in your metadata.
Segment Formatter Classes
Whereas a formatter class applies special processing to a data element, a segment
formatter class applies special processing to a whole record.
A segment formatter’s initialize operation performs any required initialization.
A segment formatter’s format operation applies specialized logic to the segment in an
outbound message.
A segment formatter’s unformat operation applies specialized logic to the segment in an
inbound message.
You create a segment formatter class as a subclass of SegmentFormatter and pass the new
class as a parameter to the IDocSegment, Segment, or RecordSegment class.
There are no predefined segment formatter classes, but here is an example from a supply-
chain solution. In this case, the special logic applies only to inbound data: if a record
represents an APO line item (as indicated by the value of the data element PROSA), the
requested quantity is set to 0.
public class FusionNAOrderItemEnrichment extends SegmentFormatter
{
public static final String apoLineItemIndicator = "PROSA";
public static final String salesOrderDetail = "SALES_ORDER_DETAIL";
public static final String itemRequestedQty =
"CUMULATIVE_ORDER_SLS_UNIT_QT";
public boolean unformat(Group group)
{
for (int i = 0; i < group.children(); i++)
{
Group orderDetail = (Group)group.child(i);
if(!orderDetail.name.equals(salesOrderDetail))
continue;
//If line item is APO line item, zero out the requested qty
String apoLineItemFlag =
orderDetail.get(apoLineItemIndicator);
if(apoLineItemFlag != null && apoLineItemFlag.equals("C"))
orderDetail.put(itemRequestedQty,"0");
}
return true;
}
}