Solved

DataViewManager to filter parent and child relation

Posted on 2004-08-30
7
1,436 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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