Solved

DataViewManager to filter parent and child relation

Posted on 2004-08-30
7
1,406 Views
Last Modified: 2008-01-09
Hi Experts,

Here is my dataset:
datatableParent : columnFileId, columnFileName
datatableChild : columnFileId, columnPathId
                               
I want to filter the parent table to get only files in the path I want.
So with my dataviewmanager, I filter like this:
dataViewManager.DataViewSettings[datatablechild].RowFilter="columnPathId='5' "; for example.
But it seems to filter only the child and not the parent.
Any Idea to filter rows in a parent table depending on criteria met in a child table ?

Thanks in advance for your answers.

0
Comment
Question by:noulouk
  • 5
  • 2
7 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
Comment Utility
0
 
LVL 37

Expert Comment

by:gregoryyoung
Comment Utility
whoops im backwards ... You can't do it directly through rowfilters because you can only use aggregates ...

PARENT/CHILD RELATION REFERENCING

A parent table may be referenced in an expression by prepending the column name with Parent. For example, the Parent.Price references the parent table's column named Price.

A column in a child table may be referenced in an expression by prepending the column name with Child. However, because child relationships may return multiple rows, you must include the reference to the child column in an aggregate function. For example, Sum(Child.Price) would return the sum of the column named Price in the child table.

If a table has more than one child, the syntax is: Child(RelationName). For example, if a table has two child tables named Customers and Orders, and the DataRelation object is named Customers2Orders, the reference would be:

Instead you would use ... GetParentRows which will get all of the parents for the records in your view http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemdatadatarowclassgetparentrowstopic.asp
0
 
LVL 9

Author Comment

by:noulouk
Comment Utility
Thanks for reply, but I'm not agree with you. The best I can do is to use getparentrows method because the child view is filtered as I want (but the parent view not), so with getparentrows methods I'll be able to retrieve my rows when I filter the child rows.
I want to know if another solution is available and more easy than mine. For example, a solution that filters rows in a parent view depending on criteria met in a child view ?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
Comment Utility
you cannot use the children in the rowfilter per the information I posted (they are only available within aggregate functions)
0
 
LVL 9

Author Comment

by:noulouk
Comment Utility
I find your post after posting mine. Now I'm agree with you.

Do you think it's possible ?
" For example, a solution that filters rows in a parent view depending on criteria met in a child view ?  "
0
 
LVL 37

Expert Comment

by:gregoryyoung
Comment Utility
if there is to be only 1 row in the child sure ... you could filter off the average aggregate of the children ...
0
 
LVL 37

Expert Comment

by:gregoryyoung
Comment Utility
the average of { 8 } is 8 :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now