Subject Re: [IBO] Joined Datasets, Insert not Refreshing Fields (2nd Post)
Author ehandbury
--- In IBObjects@y..., "Helen Borrie (TeamIBO)" <helebor@t...> wrote:
> At 09:40 PM 18-04-02 +0000, you wrote:
> >Hello,
> >
> > Sorry for the 2nd post, but I really need this answered.
> >
> >(IBO4.2Gc, BCB4, FB-1.0-796)
> >
> >I have a joined dataset:
> >select D.DESCRIPTION,M.MASTERKEY from MBMASTER M left join MBDETAIL
> >D on D.DETAILKEY=M.MASTERKEY
> >
> >I have the KEYRELATION property set so the dataset is live. I also
> >have BufferSynchFlags set to AfterInsert.
> >
> >I set the MASTERKEY field value in the OnAfterInsert event, and the
> >problem is that the row does not get refreshed until I do a
> >Refresh/Post. Is there any way to refresh the dataset after an
insert
> >while still remaining in dssInsert mode? I must use a Join since
the
> >rows are displayed in a grid.
>
> Something looks funny here. From a client perspective, this isn't
a
> master-detail setup since there is no detail dataset.
>
> If you set KEYRELATION, that makes your joined dataset "live" in
the sense
> that any changes to columns in that table will be posted. Changes
in
> columns derived from other tables won't propagated to the
underlying
> tables, since the client app has no knowledge of their relationship.
>
> If you want to implement a master-detail relationship, by all means
use the
> joined dataset as the master, but provide either
> - a detail dataset extracted from the detail table and implement
> mastersource and masterlinks; or
> - stored procedures that are called in the XXXXSQL properties of
the
> dataset to perform the changes in both underlying tables (and don't
define
> KEYRELATION).
>
> Apologies if I have misunderstood your setup....also, it's
pertinent for
> you to mention which data access components you are using.

Sorry for being confusing. This is not a master-detail. Here's the
SQL below.

select
S.DESCRIPTION,S.STEP,S.DURATION,S.AUTOCOMPLETE,A.ACTIVITYALERTKEY,
A.MASTERITEMKEY,A.ACTIVITYKEY,A.CLIENTKEY,A.USERKEY,A.ATYPE,
A.ADATE,A.ATIME,A.STATUS,A.DUEDATE,A.COMPDATE,A.COMPTIME,
A.COMPUSERKEY,A.NOTES
from MBACTIVITYALERT A LEFT JOIN MBSTEPITEM S ON
S.STEP=A.MASTERITEMKEY where ATYPE=1
ORDER BY ACTIVITYALERTKEY DESC

The problem is that MASTERITEMKEY is set in the OnInsert event, and
therefore the S.DESCRIPTION column (and all S.* columns) don't get
refreshed until the MBACTIVITYALERT dataset is refreshed/posted. I
need the MBSTEPITEM columns to be refreshed while MBACTIVITYALERT is
still in dssInsert. I am using TIB_Query. Thanks.

Eric.