Philip, I'm having trouble understanding your example given that I don't how your tables and records are layed out, so I can't complete the mental diagram. It looks like mapData is the parent, but is recordType a member of a child?
On a broader scale, does anyone know of a more complete reference for expressions? The MSDN article on the topic is a bit sketchy and lacks examples for anything other than purely basic things. It talks nothing about ins and outs of things like Child and Parent and aggregates and how they work (or don't). -----Original Message----- From: Philip Nelson [mailto:[EMAIL PROTECTED] Sent: Thursday, July 17, 2003 2:12 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Advanced DataSet Queries Here is an example that relies on the fact that .net will automatically create a relationship between the tables where there are xml nested elements. In your example person will be a parent of color because the color elements are nested in the person elements. string autoRelation; string childFilter = ""; DataView view = mapData.FixedColumnDef.DefaultView; if (recordType != null && recordType.Length > 0) { DataRelation relation = mapData.Tables["FixedParseDef"].ChildRelations[0]; if (relation != null) { autoRelation = relation.RelationName; childFilter = "Parent(" + autoRelation + ").recordType = '" + recordType + "'"; } } view.RowFilter = childFilter; --- "Woodard, John" <[EMAIL PROTECTED]> wrote: > I am looking for a way to do an advanced query quickly and > efficiently. > > Given the following XML structure read into a DataSet of people and > the colors they are wearing: > > <Person> > <Name>One</Name> > <Color>Red</Color> > <Color>Green</Color> > <Color>Blue</Color> > </Person> > <Person> > <Name>Two</Name> > <Color>Red</Color> > <Color>Green</Color> > <Color>Orange</Color> > </Person> > <Person> > <Name>Three</Name> > <Color>Blue</Color> > <Color>Green</Color> > <Color>Orange</Color> > </Person> > > Which would give me two related tables in my DataSet, Person and > Color, and assume that there are tens of thousands of people in the > table. > > How do I query for all people wearing red? It seems as if this should > be possible, even simple, but I can't find a way to do it. Doing it > row by row by using CreateChildView would take forever even on a > screaming system. Querying the color table and then building a big > honking query from the Person_id column (that ADO.NET puts in place to > relate things in this > circumstance) seems like it would be slow as well. How long would it take > ADO to parse a search statement with 10,000 ORs? Ugh.
