Dear Guru's,
I am in need on advise as to how to correctly use the formatter.js component. The purpose of the code is to display a conditional value based on predetermined data. I created a copy of a view where basically depending on the value in 'AccountCategoryName' i will decide the output value of either 'OrderNumber' or 'WbsElement' or 'CostCenter'
Here is the Code inside of the View:
<ColumnListItem type="Inactive">
<cells>
<ObjectIdentifier title="{parts:[{path : 'itemDetail>AccountCategoryName'}], formatter : 'srm.sap.purchaseOrder.util.Formatter.getName'}">
</ObjectIdentifier>
<Text text="{itemDetail>AccountCategoryName}"/>
<Text text="{parts:[{path : 'itemDetail>GLAccountName'}, {path : 'itemDetail>GLAccountNumber'}], formatter : 'sap.ca.ui.model.format.FormattingLibrary.commonIDFormatter'}">
</Text>
<ObjectNumber number="{parts:[{path: 'itemDetail>DistributionValue'}], formatter : 'srm.sap.purchaseOrder.util.Formatter.formatRoundNumber'}" numberUnit="{parts:[{path: 'itemDetail>DistributionValue'}, {path : 'itemDetail>DistributionIndicator'}, {path : 'itemDetail>/Currency'}, {path : 'itemDetail>/Unit'}], formatter : 'srm.sap.purchaseOrder.util.Formatter.accountAssignmentFormatter'}">
</ObjectNumber>
<core:ExtensionPoint name="CustomerExtensionForAccounting"/>
</cells>
</ColumnListItem>
|
here is the Code inside of the Formatter.js:
srm.sap.purchaseOrder.util.Formatter = { getName : function (var) {if(var == "Order") return {'itemDetail>OrderNumber'}
else if( var == "WBS element") return {'itemDetail>WbsElement'}
else if (var == "Cost Center") return {'itemDetail>CostCenter'} };
I am getting an error for the attached formatter.js component.