Solved

DataViewManager to filter parent and child relation

Posted on 2004-08-30
7
1,414 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
ID: 11932724
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11932780
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
ID: 11932813
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 11932856
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
ID: 11932861
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
ID: 11932884
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
ID: 11933075
the average of { 8 } is 8 :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get String split 5 48
insert image with its metadata into SQL server Database 3 88
Parse the OuterHTML Data in the txtfile using c# 4 48
Coding C# in Linux 8 24
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

23 Experts available now in Live!

Get 1:1 Help Now