Selecting rows by filterering on child columns

  • Thread starter Thread starter gumbytech
  • Start date Start date
G

gumbytech

Hi,

I am attempting to replace what I would normally be able
to do easily with joins in SQL, with relations and
rowfilters. But I am unable to see how to do the following:

I would like to select rows from a parent table based on
values in two or more child tables.

As an example let us say that I have a parent table
PetOwners, (with cols OwnerID, DogID, CatID)
with two child tables DogNames(with cols DogID, DogName)
and CatNames(with cols CatID, CatName). I have relations
from each parent column to the appropriate child table
columns (RelOwnerDog and RelOwnerCat).

I want to do a rowfilter for Owners that accomplishes:
rowfilter = "(DogName='Betsy') AND (CatName='Corky')"

So in effect I want something like
DataView dvOwnerDogCat = new DataView["PetOwners"];
//define relations (not shown)
dvOwnerDogCat.rowfilter=(Child(RelOwnerDog).
("DogName='Betsy'")) and (Child(RelOwnerCat).=
("CatName='Corky'");

Ignoring the sillyness of the example: Is it possible to
achieve this kind of filter via relations? Can you row
filter on two relations at once? Documentation seems to
indicate that you can but I have been unable to find an
example and have been unable to chance upon the
appropriate syntax.

Thanks in advance
 
What happens when you try it? I don't see any inherent problems in doing
that.

Kathleen
 
Kathleen,

I have not been able to try it because I can't get it to
compile. I can't figure out the syntax. Do you know what
it would be? The syntax below is what I think it should be
but its not right.
-----Original Message-----
What happens when you try it? I don't see any inherent problems in doing
that.

Kathleen

gumbytech said:
Hi,

I am attempting to replace what I would normally be able
to do easily with joins in SQL, with relations and
rowfilters. But I am unable to see how to do the following:

I would like to select rows from a parent table based on
values in two or more child tables.

As an example let us say that I have a parent table
PetOwners, (with cols OwnerID, DogID, CatID)
with two child tables DogNames(with cols DogID, DogName)
and CatNames(with cols CatID, CatName). I have relations
from each parent column to the appropriate child table
columns (RelOwnerDog and RelOwnerCat).

I want to do a rowfilter for Owners that accomplishes:
rowfilter = "(DogName='Betsy') AND (CatName='Corky')"

So in effect I want something like
DataView dvOwnerDogCat = new DataView["PetOwners"];
//define relations (not shown)
dvOwnerDogCat.rowfilter=(Child(RelOwnerDog).
("DogName='Betsy'")) and (Child(RelOwnerCat).=
("CatName='Corky'");

Ignoring the sillyness of the example: Is it possible to
achieve this kind of filter via relations? Can you row
filter on two relations at once? Documentation seems to
indicate that you can but I have been unable to find an
example and have been unable to chance upon the
appropriate syntax.

Thanks in advance


.
 
Back
Top