06-22-2023 7:47 AM - edited 07-17-2023 6:55 AM
People always want full OData filtering (and other OData manipulations) in SAP Build Apps. But the filtering is severely limited for most people (see this recent question).
Currently, there is no way to do a lot of the filtering OData provides, like Contains or Ends With and things like that.
To "solve" this, I used the REST data resource with destinations, instead of the OData integration. I admit you lose a lot of the advantages of the OData data resource – interpretation of the metadata, selecting all the entities, filtering/paging/ordering, and even converting the response. All that has to be done manually.
Still, I was able to filter and I thought perhaps it might help someone. Here's what I did.
I created a data resource of type "SAP BTP destination REST API integration" using a destination to the Northwind OData service.
I enabled the list action, and set it's path to a formula.
query.search.query
I then created a data variable (collection of records), and in the logic of the data variable, set the Get record collection's Search parameter.
Inside there is just query field, and I set this to the entity I wanted plus any filtering, such as:
/Customers?$filter=contains(CustomerID, 'AL')
The only other thing I had to do is, when setting the data variable from the output, I used a formula to remove the OData header:
outputs["Get record collection"].records.value
Because the OData response adds a header and my REST data resource does not handle this.
And it seemed to work:
OK, this is just something I threw together in response to a question in the community. But:
Leave your comments below.