Sorry i'm a bit of a novice on llblgen.
Do you have any examples which include, filters , and paging via a query which will allow me to perfrom a distinct on a specific field.
Please find below my existing code...
Dim filters As New SD.LLBLGen.Pro.ORMSupportClasses.RelationPredicateBucket
Dim productFactory As New FactoryClasses.CommerceProductEntityFactory
Dim productEntity As New EntityClasses.CommerceProductEntity
Dim productCollection As New HelperClasses.EntityCollection(productFactory)
Dim sorter As New SortExpression
sorter.Add(New SortClause(HelperClasses.CommerceProductFields.Name, Nothing, SortOperator.Descending))
filters.PredicateExpression.Add(HelperClasses.CommerceProductFields.Active = active)
service.FetchEntityCollection(productCollection, filters, 10, sorter, 1, 10)
Return productCollection
This at the moment returns a collection with duplicate CategoryIds, i want to somehow show the same list, but remove such duplicates as at the moment its showing the same product 5 times as its associated to numerious categories e.g.
Select p.name, p.CompanyId, p.categoryid, p.productId
from products p
inner join categories c on c.id = p.categoryid
The problem I have I this will return the same product 2 or 3 times as this product is associated to many categories, but I only want the product returned once, however I need to know at least on occurance of cateoryId. So using distinct isn’t an option.
So lets say i have something like this returned e.g.
car,1,1,1
car,1,2,1
car,1,3,1
van,1,4,2
van,1,2,2
I need to just know the unique productids AND have one occurance of categoryid, any of which will do e.g.
car,1,3,1
van,1,4,2
Hope this makes sense, and any guidance would be greatly appreciated.
Thanks