Skip to Content
0

Currency formatting in ObjectListItem Using XML View in Eclipse Luna Version

Feb 27, 2017 at 08:23 AM

175

avatar image
Former Member

Hi Experts,

I'm new to SAPUI5 Please help me ,Here I'd like to bind My JSON Data with XML View having ObjectListItem control an amount with a specific currency field and symbol , I use the following coding in a XML view but here I'm not getting currency field (amount)and symbol is not showing in any value in my app...please help me...

<ObjectListItem title="{products>ProductName}"

number="{ parts: [ {path:'products>UnitPrice'},

{path:'/CurrencyCode'}],

type:'sap.ui.model.type.Currency',

formatOptions:{ showMeasure: false} }"

numberUnit="{/currencyCode}">

</ObjectListItem>

Regards,

fayaz

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Veeraraghavan Narasimhan
Feb 27, 2017 at 04:49 PM
0

Hello Fayaz,

We would need more information about how data model looks to be able to comment further. One issue that crops to my mind is

<ObjectListItem title="{products>ProductName}" number="{ parts: [ {path:'products>UnitPrice'}, {path:'/CurrencyCode'}],
type:'sap.ui.model.type.Currency', formatOptions:{ showMeasure: false} }" numberUnit="{/currencyCode}">
</ObjectListItem> 

I can see currencyCode and CurrencyCode and is this a typo. UI5 is case sensitive.

Thanks and Regards,

Veera

Share
10 |10000 characters needed characters left characters exceeded
Matthew Reddy May 26 at 08:33 PM
0

Probably not an issue anymore but just in case...

Veera's comment of inconsistent camelCasing is the first thing to check. Another might be to check if your default model's CurrencyCode should be a relative path (i.e. {CurrencyCode} instead of {/CurrencyCode}). Often a default model in the tutorials (and in production) is assigned to an OData service, which would mean "/CurrencyCode" calls a get entity set for the CurrencyCode entity, i.e. returns a list of results whereas you want to get a single property.

If the default model is a JSON model then this pattern "/CurrencyCode" could very well be the correct property.

Share
10 |10000 characters needed characters left characters exceeded