all groups > dotnet ado.net > april 2008 >
You're in the

dotnet ado.net

group:

Limit rows in a DataView to those used in a relation with RowFilter?


Limit rows in a DataView to those used in a relation with RowFilter? Flint ZA
4/24/2008 8:48:05 AM
dotnet ado.net:
I have a simple DataSet with two tables, ParentTbl and ChildTbl. They
each have a ChildId column. They are joined by a relation
ParentTbl_ChildId which associates the ChildId column with ParentTbl
as the parent and ChildTbl as the child. This DataSet is not based on
a database (it is saved to and loaded from XML files) so SQL queries
are not an option.
I need a DataView on ChildTbl which is limited to those rows involved
in a ParentTbl_ChildId relation. I have been trying to achieve this
with the RowFilter property, but have been struggling to define the
appropriate expression. Some of the variations I have attempted are:

m_filteredView->RowFilter = L"NOT(NULL =
(Parent(ParentTbl_ChildId1).ChildId1))"; //The view just ends up being
empty

m_filteredView->RowFilter =
L"Count(Parent(ParentTbl_ChildId1).ChildId) > 0"; // Throws
SyntaxErrorException with "Syntax error in aggregate argument:
Expecting a single column argument with possible 'Child' qualifier."

m_filteredView->RowFilter = L"ChildId
IN(Parent(ParentTbl_ChildId1).ChildId1)"; //Throws EvaluateException
with "Only constant expressions are allowed in the expression list for
the IN operator."

Is this even possible? Can anyone suggest an expression that might
AddThis Social Bookmark Button