Hi All,
I've got a simple problem to which I can't seem to find out the logical and simple solution.
The following situation:
I've got Orders, Orders have PurchaseItems (A purchase item contains the information that has been sent to a manufacturer as purchase for this order). Each OrderItem contains a SupplierId, so I know which OrderItem has to be supplied by whom.
I now want a query which returns all Orders for which no PurchaseItem is available for a certain supplierId. (So I can track the orders that still have purchasing to do per supplier, a purchase tracking screen shows a list of all supplier for which purchasing is still required and under each supplier the orders are shown).
I tried this using joins, etc.. But the only thing I am succeeding in is getting the orders which DO have a purchase item for a certain supplier:
OrderCollection orders = new OrderCollection();
RelationCollection relations = new RelationCollection();
relations.Add(OrderEntity.Relations.OrderItemEntityUsingOrderId);
relations.Add(OrderEntity.Relations.PurchaseEntityUsingOrderId);
PredicateExpression orderFilter = new PredicateExpression();
// This line without the second predicate makes sure I return all orders relevant to the supplier
orderFilter.Add(OrderItemFields.SupplierId == supplierId);
// This lin returns all orders which also have bene purchased for this supplier
orderFilter.Add(PurchaseFields.SupplierId == supplierId);
I thought about negating the (PurchaseFields.SupplierId == supplierId) part, but no succes.
Who can pull me out of the problem and give me helicopter view again
thanks,
Gab