cancel
Showing results for 
Search instead for 
Did you mean: 

(how) can we use IN clause in $filter

1,130

Hi,

we are using SAP CAP but when I want to use an IN clause in a $filter variable so like:

http://localhost:4004/v1/api/SomeEntity?$filter=myId in ('0001','0002')

I get:

<error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
<code>400</code>
<message>The type 'Edm.String' is not compatible to 'Edm.Boolean'</message>
</error>

Does CAP support the IN clause in a filter?

vivekananda_panigrahy
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi

I saw in the latest CDS release the $filter is supported. I am also updated to the latest CDS version but i could not get $filter IN working. Have you tried with the latest?

localcdsversion.png

Please see the attached screenshot for details.

Thanks.

Vivek

View Entire Topic
david_kunz2
Product and Topic Expert
Product and Topic Expert

Hi ramondb ,

This is not supported yet, but we're already working on it (CAP Node.js).

Best regards,

David

0 Kudos

ok thanks for the quick response

vivekkumar_gupta2
Discoverer
0 Kudos

Dear colleagues ,

By when do you plan to support this . Also is there a JIRA which we can link with our task so that we will refactor our code when it is available ?

Thanks

Vivek

david_kunz2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vivek,

Unfortunately I can't give a timeline because this feature will be released together with many others, and it's unclear when this will happen.

But with every release we provide a list of changes: https://cap.cloud.sap/docs/releases/


Best regards,
David

rezanazeman
Newcomer
0 Kudos

david.kunz2

Hi David,

from release changelog Aug22, the "IN" filter functionality should be available, now.

Using new cap cds version 6.4.1 still shows the same error message like initially mentioned in this forum:


The type 'Edm.String' is not compatible to 'Edm.Boolean'

It seems that nothing has changed yet. Do you have any update for us?

Thanks. BR Reza

david_kunz2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi rezanazeman ,

There are no updates yet. This will probably be fixed once we change our OData parser, but that's a bigger change and might take a while.
For now, you should use the or filter.

Best regards,
David

seth_esch
Explorer
Hi David, is a list of the supported odata filter-criteria available anywhere in the cap-doc? It took us disproportionately long to find this blog-entry ensuring that this is a deficit of cap and not a user-error on our side. It would be nice not having to go through this again.