Hi there,
I have a EntityCollection<OrdersBesteld> which fetches relational tables using prefetchpath and RelationPredicateBucket.
In my grid I would like to show no duplicate rows.
This is what I have now:
RelationPredicateBucket rpb = new RelationPredicateBucket();
SortExpression se = new SortExpression(OrdersBesteldFields.ProductenId | SortOperator.Ascending);
if (productId != null)
{
IPredicateExpression pexProductId = new PredicateExpression();
pexProductId.Add(new FieldCompareValuePredicate(OrdersBesteldFields.ProductenId, null, ComparisonOperator.Equal, productId));
rpb.PredicateExpression.Add(pexProductId);
}
rpb.Relations.Add(OrdersBesteldEntity.Relations.OrdersEntityUsingOrdersId);
rpb.Relations.Add(ContactpersonenEntity.Relations.OrdersEntityUsingContactpersonenId);
EntityCollection<OrdersBesteldEntity> fetchedEntities = (EntityCollection<OrdersBesteldEntity>)GetEntityCollection(new EntityCollection<OrdersBesteldEntity>(), rpb, 0, se, GetPrefetchPath(EntityType.OrdersBesteldEntity));
List<IEntityPropertyProjector> propertyProjectors = new List<IEntityPropertyProjector>();
propertyProjectors.Add(new EntityPropertyProjector(OrdersBesteldFields.OrdersId, "OrdersId"));
propertyProjectors.Add(new EntityPropertyProjector(OrdersBesteldFields.Product, "Product"));
propertyProjectors.Add(new EntityPropertyProjector(OrdersFields.Inboekdatum, "Inboekdatum"));
propertyProjectors.Add(new EntityPropertyProjector(ContactpersonenFields.Voorletters, "Voorletters"));
propertyProjectors.Add(new EntityPropertyProjector(ContactpersonenFields.Tussenvoegsel, "Tussenvoegsel"));
propertyProjectors.Add(new EntityPropertyProjector(ContactpersonenFields.Achternaam, "Achternaam"));
DataTable projection = new DataTable();
fetchedEntities.DefaultView.CreateProjection(propertyProjectors, projection, false);
This is my result for the fetchedEntities in a gridview:
Id Name Date
12345 T. van Est 01-02-2010
12345 T. van Est 01-02-2010
the Id, Name and Date are all from related entities (Orders and Contactpersonen)
I would like to get this in my grid:
Id Name Date
12345 T. van Est 01-02-2010
So not the second (duplicate) row...
How can I do this ?
Kind regards
Nathan