Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3280

Correct use of formatter.js

$
0
0

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&gt;AccountCategoryName'}], formatter : 'srm.sap.purchaseOrder.util.Formatter.getName'}">

</ObjectIdentifier>

<Text text="{itemDetail&gt;AccountCategoryName}"/>

<Text text="{parts:[{path : 'itemDetail&gt;GLAccountName'}, {path : 'itemDetail&gt;GLAccountNumber'}], formatter : 'sap.ca.ui.model.format.FormattingLibrary.commonIDFormatter'}">

</Text>

<ObjectNumber number="{parts:[{path: 'itemDetail&gt;DistributionValue'}], formatter : 'srm.sap.purchaseOrder.util.Formatter.formatRoundNumber'}" numberUnit="{parts:[{path: 'itemDetail&gt;DistributionValue'}, {path : 'itemDetail&gt;DistributionIndicator'}, {path : 'itemDetail&gt;/Currency'}, {path : 'itemDetail&gt;/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&gt;OrderNumber'}

else if( var == "WBS element") return {'itemDetail&gt;WbsElement'}

else if (var == "Cost Center") return {'itemDetail&gt;CostCenter'} };

 

I am getting an error for the attached formatter.js component.


Viewing all articles
Browse latest Browse all 3280

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>