R
Rick
I posted a previous message similar to this, but I think that the
presentation wasn't complete.
Thanks to all who tried to decypher the mess. Hopefully this message
will be more understandable.
I have a need to Filter a master DataView (easily) through a
DataRelation and from a child DataView.
For instance, using a Typed DataSet based upon the Northwind Tables
Orders and [Order Details] with a DataRelation
(OrdersOrderDetailsRelation) setup between the two (Orders = Parent /
OrderDetails = Child)
If we populate each of the DataTables (Orders and OrderDetails) with
the full contents of each database table, the DataTables (Orders and
OrderDetails) will in fact contain all the applicable data.
ComponentManager.Instance.Orders.PopulateOrders(_ordersData);
ComponentManager.Instance.OrderDetails.PopulateOrderDetails(_ordersData);
Now, if I use the DefaultView of the DataSet's OrderDetails DataTable
to set the RowFilter = ProductId = 5, and then look at the
DefaultView's count it will show 10 DataRowViews, exactly as I would
expect.
_ordersData.OrderDetails.DefaultView.Count will return 10.
I need to access all of the Orders records associated with these 10
records. I had hoped that I could create another DataView based upon
the Orders DataTable - but with respect to this
OrderDetails.DefaultView.RowFilter, possibly by the
OrdersOrderDetailsRelation.
Something like:
_ordersData.Orders.DefaultView.RowFilter =
"Orders.OrdersOrderDetailsRelation.ProductId=5"
OR
_ordersData.OrderDetails.DefaultView.DataViewManager.CreateDataView(_ordersData.Orders);
// Shouldn't this work? Creating a DataView from the Filtered
DataView.DataViewManager?
Best regards,
Rick
presentation wasn't complete.
Thanks to all who tried to decypher the mess. Hopefully this message
will be more understandable.
I have a need to Filter a master DataView (easily) through a
DataRelation and from a child DataView.
For instance, using a Typed DataSet based upon the Northwind Tables
Orders and [Order Details] with a DataRelation
(OrdersOrderDetailsRelation) setup between the two (Orders = Parent /
OrderDetails = Child)
If we populate each of the DataTables (Orders and OrderDetails) with
the full contents of each database table, the DataTables (Orders and
OrderDetails) will in fact contain all the applicable data.
ComponentManager.Instance.Orders.PopulateOrders(_ordersData);
ComponentManager.Instance.OrderDetails.PopulateOrderDetails(_ordersData);
Now, if I use the DefaultView of the DataSet's OrderDetails DataTable
to set the RowFilter = ProductId = 5, and then look at the
DefaultView's count it will show 10 DataRowViews, exactly as I would
expect.
_ordersData.OrderDetails.DefaultView.Count will return 10.
I need to access all of the Orders records associated with these 10
records. I had hoped that I could create another DataView based upon
the Orders DataTable - but with respect to this
OrderDetails.DefaultView.RowFilter, possibly by the
OrdersOrderDetailsRelation.
Something like:
_ordersData.Orders.DefaultView.RowFilter =
"Orders.OrdersOrderDetailsRelation.ProductId=5"
OR
_ordersData.OrderDetails.DefaultView.DataViewManager.CreateDataView(_ordersData.Orders);
// Shouldn't this work? Creating a DataView from the Filtered
DataView.DataViewManager?
Best regards,
Rick