Subject Re: [IBO] Strange behaviour with linked IB_Grids
Author Nando Dessena
Jason,

> It looks to me like you also have a KeySource based relationship configured
> somehow.

Yep. I should have stated all the settings and not just half of them.
Fortunately that's the subject of a message I once posted to this same
list. It should explain my structure:

> I have three IB_Queries on a form; Query1 (companies) is the master,
> Query2 is a detail query (locations) and so is Query3 (employees). In
> short, I can have several locations and several employees for each
> company.
> In addition, each employee does refer to a company, so I have a
> LookupCombo and a lookup IB_Query on the locations table. That lookup
> query has the employees' DataSource as KeySource and the locations
> DataSource as MasterSource (I intend to show only the locations of the
> master company available for each employee).
>
> If I insert a company, then a location and then try to insert an
> employee, my lookup combo is empty because its dataset isn't refreshed
> after the post on the locations dataset.
> I have added a call to RefreshKeys in the employees dataset's
> AfterEdit/AfterInsert event handlers, and I was wondering if this is the
> most appropriate way to do it or there are any pitfalls. I don't have
> the need to cope with other users inserting locations at the same time
> (the application is for my personal use), but I think the RefreshKeys
> call is ok for that too (I have a read-committed transaction).

For the record, you replied it was fine, so it has stayed this way ever
since.

> This could also be the result of fixing a bug some time ago that the detail
> dataset's AfterScroll event was not firing when the master dataset was
> scrolled...
>
> Hmmm...
>
> > TIB_Column.Clear
> > TIB_Column.Assign(???)
> > TIB_Dataset.SysUpdateKeyLinksData
> > TIB_Dataset.SysAfterScroll
> > TIB_BDataset.SysAfterScroll
>
> This is the section I am curious about. Why would it call
> SysUpdateKeyLinksData?

See above.
Thanks.

> > <third query beforeedit handler>
> > LanunchDSEvent(???, some address)
> > TIB_Dataset.DoBeforeEdit (this is the detail-detail dataset).
> > TIB_Dataset.SysBeforeEdit
> > TIB_Dataset.SysEdit
> > TIB_Dataset.SysBeforeFieldDataChange(???, ???)
> > TIB_Row.DoBeforeModify(???)
> > TIB_Row.SysBeforeModify(???)
> > TIB_Row.SysBeforeColumnModify(???)
> > TIB_Column.SysBeforeModify
> > TIB_Column.SetIsNull(True) (did I say that if I try to post the edit it
> > complains that the key field is not assigned?)
> > TIB_Column.Clear
> > TIB_Column.Assign(???)
> > TIB_Dataset.SysUpdateKeyLinksData
> > TIB_Dataset.SysAfterScroll
> > TIB_BDataset.SysAfterScroll
> > TIB_Dataset.SysRefresh(False)
> > TIB_Dataset.RefreshKeys
> > TIB_Dataset.SysAfterParamsDataChange(???, ???)
> > TIB_Row.DoAfterModify(???)
> > TIB_Row.SysApplyUpdates(???)
> > TIB_Row.EndUpdate(???)
> > TIB_Dataset.SysMasterDataChange(???)
> > TIB_Dataset.IB_MasterDataChange(???, ???, nil)
> > TIB_DataLink.DoDataChange(???)
> > TIB_DataLink.SysDataChange(nil)
> > TIB_DataLink.ProcessStatementEvent(setFieldsDataChange, 0)
> > TIB_DataSource.ProcessEvent(setFieldsDataChange, 4299748)
> > TIB_Statement.ProcessEvent((out of bound) -28, 4332764) (this just
> > doesn't look good)
> > TIB_Dataset.ProcessLinkEvent(setFieldDataChange, 0)
> > TIB_Dataset.EnableControls
> > TIB_Dataset.MoveBy(???)
> > TIB_Dataset.Next
> > <navigation bar calls>
> >
> > Hope this helps some.
> > For the sake of completeness I'll add that I am doing a Refresh of a
> > dataset that is used as a lookup by the third query, and I am doing it
> > in the afteredit and afterinsert event of this third query.
> > I am also calling RefreshRows on the second query in its own afterpost
> > handler.
--
____
_/\/ando