We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataManager Query Equivalent of SELECT * FROM table WHERE id IN (...)

Thread ID:

Created:

Updated:

Platform:

Replies:

148046 Oct 2,2019 03:02 PM UTC Oct 7,2019 09:34 AM UTC JavaScript - EJ 2 5
loading
Tags: DataManager
Kelly Harrison
Asked On October 2, 2019 03:02 PM UTC

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

Pavithra Subramaniyam [Syncfusion]
Replied On 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. 


Kelly Harrison
Replied On 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

Pavithra Subramaniyam [Syncfusion]
Replied On 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. 


Kelly Harrison
Replied On October 4, 2019 05:39 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. 


Is there a way to manipulate the OData query uri directly then?  It does appear that OData supports the 'IN' option:

http://host/service/Products?$filter=Name in ('Milk', 'Cheese')

Pavithra Subramaniyam [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon