qor | QOR is a set of libraries written in Go that abstracts common features needed for business applicati | REST library
kandi X-RAY | qor Summary
Support
Quality
Security
License
Reuse
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
qor Key Features
qor Examples and Code Snippets
Trending Discussions on qor
Trending Discussions on qor
QUESTION
I am using Odata as my service to get an IQueryable of a class to my Kendo Grid. I have a List of strings of Item Numbers and I need to filter one of my IQueryable classes to only show the Item Numbers from the class that are in that List of strings and keep it an IQueryable.
I have already tried to use Contains in order to filter out the Item Numbers in the list but I am getting the error message "The method 'Contains' is not supported'. I need to keep it an IQueryable also.
The following is the code that I am working with:
var service = RetailHelper.GetODataItemService();
var query = from a in service.ItemAssortment
where a.Item_Nbr == itemNumber && a.AuditYear == 2018
select a;
var newQuery = query.ToList();
var queryList = newQuery.Select(x => x.Assortment_Nbr.ToString()).Distinct().ToList();
//queryList now has the List of strings that I want to use as the filter
var itemQuery = from a in service.Items
select a;
//I now need to filter itemQuery to only include all the Item Numbers that are in queryList. This is where my dilemma is.
var dsq = RetailerHelper.CreateDataServiceQuery(itemQuery, request);
//The above is where I will enter in the filtered itemQuery
var qor = dsq.IncludeTotalCount().Execute() as QueryOperationResponse
var result = new DataSoureResult() { Data = qor.ToList(), Total = Convert.ToInt32(qor.TotalCount) };
return result;
ANSWER
Answered 2019-Jun-16 at 06:11You can start with queryList
instead of itemQuery
:
var filtered = queryList.SelectMany(x=> itemQuery.Where(item => item.Number == x).ToList());
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install qor
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page