Skip to Content

BOOLEAN oData value is coming as string in UI5?

Jul 22, 2017 at 01:16 PM


avatar image


My requirement is to bind editable property of a field in table to JSON model so that the field will be editable depending on oData Model. Now, the value of EDIT_FLAG is coming as Boolean in SAP Gateway, but when I try to consume the same in UI5, in the Model it is coming as string value. So when I am binding it to Input field its showing as '"false" is of type string, expected boolean for property "editable" of Element'

In OData, below is the screen shot:


But in UI5 it is coming as string




odata.jpg (17.4 kB)
ui5.png (8.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sharath M G Jul 22, 2017 at 06:02 PM

Use a formatter.


// Binding in the view

state="{ path: 'EDIT_FLAG', formatter: 'getBooleanValue' }"

// Formatter function
getBooleanValue: function(EDIT_FLAG){

var booleanVal = (EDIT_FLAG === "true");

return booleanVal;

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Sharanth,

Thanks for your response.

I am not looking at the function to translate string to boolean, the need is to get the value of boolean as is from Model directly so that I can bind that model to table directly with out any modifications. The model will have n number of records and it changes depending on inputs and I have to use these functions often which will not be a good design


Well as I know the Jain transfers strings through oData transfer.