on 04-29-2015 5:52 PM
Hi everyone,
I'm trying to filter datetime oData results from a SAPUI5 application.
I'm doing it like:
var currentFormattedDate = "datetime'2015-29-04T00:00:00'";
var newFilter = new sap.ui.model.Filter("Date", sap.ui.model.FilterOperator.EQ, currentFormattedDate);
But doing it like this the request that SAPUI5 application is sending to oData is something like: Date%20eq%20datetime%270NaN-NaN-NaNTNaN%3aNaN%3aNaN%27
Is there any other way to do that filter works?
Thanks,
Marcel.
currentFormattedDate should be Date not String
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Now I'm creating currentFormattedDate with a function that returns string var created like:
return "datetime'" + yyyy + "-" + mm + "-" + dd + "T00:00:00'";
It can't be do it like this? In oData request by url must be this => "Date eq datetime'2015-04-29'" so I supposed that with a string should be possible.
Filter will take acare of the formating
lets say you use DateRage control
searchData.fromDate = dateRange.getDateValue();//javascipt Date
searchData.toDate = dateRange.getSecondDateValue();//javascipt Date
new sap.ui.model.Filter({
path: "DocumentDate",
operator: sap.ui.model.FilterOperator.BT,
value1: searchData.fromDate,
value2: searchData.toDate
}));
will produce
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.