Reputation: 169
I need to show all data where column data is Null
or NOT Null
, that is similar to SQL
operator ISNULL
. I have tried with sap.ui.model.filteroperator
but not getting anything compare for NULL
. If you know the solutions please help.
Upvotes: 0
Views: 6198
Reputation: 784
String Data Type can hold null
and ""
value
and hence depends on if you want to filter both
you would need to query for both i.e.
oTable.getBinding("items").filter([
new Filter("property", "EQ", null),
new Filter("property", "EQ", "")
])
non-String data types:
can hold only null
and hence you can query
oTable.getBinding("items").filter([new Filter("property", "EQ", null)])
Upvotes: 0
Reputation: 5713
I would suggest you project on the column of your VDM view to a new calculated attribute. Converting the value based on isnull
function to a Empty string.
if(isnull("Column"),'',"Column")
Upvotes: 1
Reputation: 5206
As @Prashob said, you can use the filter construct. You can use it with the "null" keyword as well. Example:
oTable.getBinding("items").filter([new Filter("property", "EQ", null)])
Or in an XML view:
<Table items="{
path: '/collection',
filters: [{path: 'property', operator: 'EQ', value1: null}]
}">
If you are using a JSONModel, then this will work without any issues. If you are using an OData service, then it depends a little on the backend. Normally, it should work (e.g. see the Northwind service; it supports null comparison: http://services.odata.org/Northwind/Northwind.svc/Customers?$filter=Region%20eq%20null); the underlying implementation should know to translate the OData filter into an appropriate WHERE clause (i.e. IS NULL
instead of = NULL
)
Upvotes: 2
Reputation: 400
You can use Filter
for example,
Upvotes: 0