Skip to Content
avatar image
Former Member

Currency formatting in ObjectListItem Using XML View in Eclipse Luna Version

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Feb 27, 2017 at 04:49 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • May 26, 2018 at 08:33 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded