Skip to Content
0
Jan 17, 2019 at 11:08 AM

Fail to filter date in Sapui5 unsupported data type

275 Views Last edit Jan 17, 2019 at 11:32 AM 3 rev

I have an error filtering by date with another different format.

I am filtering perfectly from the date field CreateDate from BusinessPartners in Services Layer of type Edm.DateTimeOffset

<Property Name="CreateDate" Type="Edm.DateTimeOffset"/>

Controller

    onSearch: function(oEvent) {
        var oFilterModel = this.getView().getModel("filters");

        var sDate= oFilterModel.getProperty("/datefrom");
        var sDate2 = oFilterModel.getProperty("/dateto");

        if(date) {
            // formatear fecha 
            var oDateFormat = sap.ui.core.format.DateFormat.getInstance({
              pattern : "yyyy-dd-MM"
            });
            var from= oDateFormat.format(new Date(sDate));
            var to= oDateFormat.format(new Date(sDate2));
            aFilters.push( new sap.ui.model.Filter("CreateDate", sap.ui.model.FilterOperator.BT,  "'"+from+"'", "'"+to+"'") );
        }

   }
View
                    <DateRangeSelection
                        placeholder="Select ..."
                        dateValue="{path:'filters>/datefrom'}"
                        secondDateValue="{path:'filters>/dateto'}"
                    />
Now, when I connect to another database, with the date field CreateDate is of type Edm.DateTime
<Property Name="CreateDate" Type="Edm.DateTime"/>
I get the following error
Error in hasPendingChangesForPath - Error: Unsupported type: Edm.DateTime ...... ... ... at Array.map () sap.ui.model.odata.v4.ODataBinding

Attachments

screenshot-4.png (226.8 kB)
screenshot-6.png (24.5 kB)
screenshot-7.png (18.9 kB)