dataview.rowfilter using relations

P

pmcguire

I have a dataset with 3 tables -- 2 Parent tables and 1 table that is a child
table of both the parents. I create a dataview on the child table and set
the rowfilter to a value which filters the child based on values in both
parent tables. When I edit the parent tables the edit is not reflected in
the dataview.count property. How can I force the dataview to refresh
following parent table edits?

For example:

Parent1
Parent1ID Included Selected
1 0 0
2 0 0

Parent2
Parent2ID Included Selected
1 0 0
2 0 0

Child
ParentID1 ParentID2 Value
1 1 foo1
1 2 foo2
2 1 foo3
2 2 foo4

dv = new dataview(child)
dv.rowfilter="Parent(Parent1Child).Included = True AND
Parent(Parent1Child).Selected = True AND Parent(Parent2Child).Included = True
AND Parent(Parent2Child).Selected = True)"
dv.count = 0

I edit Parent1 so that Parent1ID 1 is both in included and selected and
Parent2 so that Parent2ID 2 is both included and selected.
dv.count is still 0. Why?
 
C

Cor Ligthert[MVP]

Pat,

A DataView is just an other word for the DefaultView in a DataTable, it
reflects all the data conform the options you have set.
You can create more DataViews for a DataTable then one DataTable, therefore
beside the defaultview there are DataViews, however they return only the
data that is in a datatable, conform that datatabe. Moreover a DataTable is
dynamic every change is direct procesed (there was a bug about that in
version 1.x, so as you are using that, you have to go around that).

Therefore look at your datatable, and for sure not to the dataview.

To see what is not showed, simple start with a dataview and add piece by
piece the elements for your rowfilter.

Cor
 
P

pmcguire

I am editing the datarows through a structure like:

dim dr1 as dataset1.Parent1Row
dim dr2 as dataset1.Parent2Row

dr1 = dataset1.Parent1.FindByParent1ID(1)

dr1.BeginEdit
dr1.Included = 1
dr1.Selected = 1
dr1.EndEdit

dr2 = dataset1.Parent2FindByParent2ID(2)

dr2.BeginEdit
dr2,Included = 1
dr2.Selected = 1
dr2.EndEdit

And yes, I am using framework 1.1. What is the best workaround?
 
C

Cor Ligthert[MVP]

Pam,

For you start with a work around for the dataview. The EndEdit was as well
(but then completely) a bug in version 1.1, you can simply go around that by
using the EndCurrentEdit which is commenly used for that in 1.1. Before
there was 2.0 I even did not know it was a bug, I simply used forever the
EndCurrentEdit.

I think you better can try that first.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top