http://host/service/Products?$filter=Name in ('Milk', 'Cheese')- Home
- Forum
- JavaScript - EJ 2
- DataManager Query Equivalent of SELECT * FROM table WHERE id IN (...)
DataManager Query Equivalent of SELECT * FROM table WHERE id IN (...)
I need to query an OData source to return records whose ID is in a list. I assume this is possible with a Query, but I can't find the correct syntax. Any help would be appreciated.
Thanks!
-k
SIGN IN To post a reply.
5 Replies
PS
Pavithra Subramaniyam
Syncfusion Team
October 3, 2019 08:37 AM UTC
Hi Kelly,
Thanks for contacting Syncfusion support.
You can achieve your requirement by using the “where” method of EJ2 DataManager Query. Please refer to the below documentation for more information.
Regards,
Pavithra S.
KH
Kelly Harrison
October 3, 2019 06:34 PM UTC
Could you please post an example? If I have an array
[2, 3, 4. 8, 9, 10, ...]
and a table as such:
ProductId,
CustomerId,
ProductName,
...
and I want all results where the customer_id is in that array...?
-k
PS
Pavithra Subramaniyam
Syncfusion Team
October 4, 2019 12:15 PM UTC
Hi Kelly,
Thanks for your update.
By default one to many filtering is not supported in EJ2 DataManager. So we could not query the array values using DataManager which is the default behavior.
Regards,
Pavithra S.
Hi Kelly,
Thanks for your update.
By default one to many filtering is not supported in EJ2 DataManager. So we could not query the array values using DataManager which is the default behavior.Regards,Pavithra S.
Is there a way to manipulate the OData query uri directly then? It does appear that OData supports the 'IN' option:
PS
Pavithra Subramaniyam
Syncfusion Team
October 7, 2019 09:34 AM UTC
Hi Kelly,
Thanks for your update.
Yes. You can achieve your requirement by using predicate which helps to build complex filter Query. Please refer the following documentation link for more information.
Sometimes the built-in adaptors does not meet your requirement. In such cases you can create your own adaptor. Please refer the below documentation link for more information. You can override the default Query of the Odata Adaptor by overriding processQuery and processResponse methods.
Regards,
Pavithra S.
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
KH Kelly Harrison
- Oct 2, 2019 03:02 PM UTC
- Oct 7, 2019 09:34 AM UTC