Solved

Can I filter on array elements a saved query (ODATA capabilities in 22R1)?

  • 18 August 2022
  • 1 reply
  • 554 views

Userlevel 2
Badge +7

References can be used in filters and are also expandable items. Hence, we can have a saved query that filters on a value in a reference. Example: find the inventory parts for planner with name ‘Kenneth Pettersson’. Odata string would look like this:

<your server stuff>/main/ifsapplications/projection/v1/InventoryPartHandling.svc/InventoryPartSet?$select=Contract,PartNo,PlannerBuyer&$filter=PlannerBuyerRef/BuyerName eq 'Kenneth Pettersson'

And I can use “PlannerBuyerRef/BuyerName eq 'Kenneth Pettersson'” in the Advanced option for a saved query, or in a lobby data source based on a projection.

In theory, Odata 4.0 would support filtering also on array contents, I think. But any way I try, I either get syntax error or ODP_NOT_IMPLEMENTED messages.

E g this “should” work according to the Odata 4.0 documentation:

<your server stuff>/main/ifsapplications/projection/v1/ShopOrderHandling.svc/ShopOrds?$filter=MaterialArray/$count lt 10

Response: 

{"error":{"code":"ODP_NOT_IMPLEMENTED","message":"Unsupported operation."}}

Filtering on array content would be very useful for advanced queries. Is this going to be supported, is it not supposed to be, or am I doing it the wrong way?

The technical documentation for 21R2 contained some information about supported and not supported parts of the Odata standard, but I did not find anything here:

https://docs.ifs.com/techdocs/22r1/060_development/022_user_interface/030_aurena_dev/010_aurena_overview/

Just a reference to Odata 4.0.

icon

Best answer by chanaka-shanil 22 August 2022, 13:54

View original

1 reply

Userlevel 6
Badge +15

Unfortunately, this kind of operations against Array Reference are not supported. We have documented some information here: Supported Functionalities - Technical Documentation For IFS Cloud but it’s missing mentioning this. I will update the documentation.

Basically we currently don’t support Lambda Operations (used to filter arrays). $count is support but not in combination with $filter.

We have an item to improve this area and I will add this to it.

To get around this for now, one option would be to define a Custom Attribute on the parent and then use that for the filtering 

Reply