Subject | RE: [IBO] Simple question about "Dataset cannot scroll" |
---|---|
Author | Daniel Jimenez |
Post date | 2004-11-29T05:10:54Z |
>Hi helen,
> OK, the first suggestion is that you use MasterSource to set
> the detail-to-master linkage!!! Datasource is used for
> TIBOQuery because the TDataset architecture doesn't implement
> Mastersource for its query components and descendants.
>
> The second suggestion is that you revisit the query you are
> using to get the detail dataset. Using outer joins doesn't
> gel well with master-detail linking under any conditions but
> here you have an outer join that actually involves the master
> table -- hence introducing a circular relationship of some kind.
>
> The third thing is that, once you have sorted out a detail
> set that can logically be a detail to that master, make
> certain that you have all of the keylinks you need in order
> for the detail dataset to find the required record in the
> sets your xxxxSQL statements refer to. You currently have
> potential nulls in the key because of the outer joins and the
> circular reference to the master.
>
> The fourth suggestion is that (again, once you have that
> detail set properly sorted) you absolutely ensure that you
> refresh the detail set immediately after performing any DML,
> since your EditSQL is breaking the master-detail relationship.
>
> If I ended up with this kind of pickle in a master-detail
> structure, I'd be taking a harsh, critical look at my table
> structures to work out where I stuffed up in my data modelling.
>
> Helen
>
>
OK I have set the IB_Query_Detail MasterSource Property to point to the
IB_DataSource of the IB_Query_Master.
The will need some help with the SQL, as I am not able to come up with an
alternative.
The detail table is defined as:
CREATE TABLE ACM_DOUBLEKNOCKITEMS
(
DNI_DN_ID D_NOT_NULL_ONE ,
DNI_AC_ID D_NOT_NULL_ONE ,
CONSTRAINT PK_DOUBLEKNOCKITEMS PRIMARY KEY (DNI_DN_ID, DNI_AC_ID)
);
ALTER TABLE ACM_DOUBLEKNOCKITEMS ADD CONSTRAINT FK_DNI_AC_ID
FOREIGN KEY (DNI_AC_ID) REFERENCES ALARMCODES
(AC_ID)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE ACM_DOUBLEKNOCKITEMS ADD CONSTRAINT FK_DNI_DN_ID
FOREIGN KEY (DNI_DN_ID) REFERENCES ACM_DOUBLEKNOCK
(DN_ID)
ON DELETE CASCADE
ON UPDATE CASCADE;
As you can see is a table with only two fields which are foreign keys.
What I am trying to achieve with the SQL s that once the application user
clicks on a record on the left grid(master records), which displays the
DN_ID of the ACM_DOUBLEKNOCK, the right grid(detail records) will display
any records which have DNI_DN_ID = DN_ID.
And if the user would like to insert a new detail record, I would like the
right grid to by default populate the DNI_DN_ID field with the currently
selected master DN_ID record data.
I am not sure if I have explain myself clearly.
Any help regarding the SQL for the detail would be very welcome
Thanks
danieL.
____________________________
Comvision Pty. Ltd.
www.comvision.net.au