tarzanbappa
tarzanbappa

Reputation: 4958

SAP Fiori IOS SDK Offline OData Filter Issue

I'm trying to add a query to offline provider as below. And I'm trying to add a filter condition for a DateTime property of my entity. Data types of startdate property both the proxy generated object and the CommonUtility.getDefaultStartDateEndDate().startDate are same - Local-DateTime

try offlineODataProvider.add(definingQuery: OfflineODataDefiningQuery(name: MobileServiceMetadata.EntitySets.svsOrderList.entityType.localName, query:
 DataQuery().from(MobileServiceMetadata.EntitySets.svsOrderList).where(SvsOrderListType.plannedStartDate.greaterThan(CommonUtility.getDefaultStartDateEndDate().startDate)).selectAll(),automaticallyRetrievesStreams: false));

But it gives an error saying there is a syntax error in the OData query. So when I check the URL in the description of the error it is like below.

https://mobileURL.com/MService/svsOrderList?$select=*&$filter=(PLANNED_START_DATE gt 2018-09-13T15:45:51.950))

So there is an error in the url because the Datetime value should be converted to datetime in OData URL as below ( Correct URL must be )

https://mobileURL.com/MService/svsOrderList?$select=*&$filter=(PLANNED_START_DATE gt datetime 2018-09-13T15:45:51.950))

This conversion should be done by the SDK itself no idea about how to fix this issue?

Is there any way to resolve this?

Upvotes: 0

Views: 373

Answers (1)

user6177399
user6177399

Reputation:

I assume you are using a OData Service V4 (as the dateTime statement is not included in the filter) ?

So the issue would be not the missing term “datetime”, but the “startdate”-format. Looks like “CommonUtility.getDefaultStartDateEndDate().startDate” returned a DateTime instead a DateTimeOffset like required

The correct URL would be https://mobileURL.com/MService/svsOrderList?$select=*&$filter=(PLANNED_START_DATE gt 2018-09-13T15:45:51.950Z)) which should be automatically generated if startDate is returning a DateTimeOffset

Upvotes: 0

Related Questions