Subject Re: [IBO] MasterDetail - Again
Author Helen Borrie
At 01:46 AM 14/08/2004 +0000, you wrote:
>I'm still struggling to come to grips with the behaviour of
>TIBOxxxxx components when using Master-Detail. I'm new to SQL and
>have no experience with IBO. Have recently obtained Helen Borrie's
>excellent book and have a pretty good grasp of the fundementals of
>DB modelling.
>
>I've bought and read Getting Started Manual and looked at the Online
>FAQ's but cannot get the relationship to work the way I think they
>should - I'm obviously missing something very basic here.
>
>Example: (Experimental - learning only)
>
>Drop TIBConnection and TIBTransaction on form.

1. If you used a TIBTransaction, it won't work. TIBTransaction is part of
InterBaseXpress.

>Make
>TIBTransaction 'join' to TIBConnection.

As a "newbie" you would do better to stick with TIBODatabase.


>2 small tables master-detail using TIBOTables and IP Grids.

Depending on age and version of your InfoPower controls, possibly you need
to use the IPIBO-- units (in your IBO root).

For initial self-teaching, stick with the Delphi data-bound controls, to
eliminate possible version incompatibility problems with InfoPower.


>Master-Detail linked through MasterSource and MasterFields properties
>Can scan through previously enter Master records and see the
>corresponding detail records.

OK.


>In master table grid enter a complete master record - but do not
>post it
>
>Move to detail table grid and enter detail fields - MasterID field
>automatically contains current (as yet unposted) MasterID from
>Master table. All fields contain values. Now attempt to post the
>detail record. This fails since linked master record has not been
>posted therefore the FK constraint fails.

It works fine here.


>This is where my misunderstanding of what should happen comes in:-
>
> >From my reading I thought that IBO would perform a Postretaining on
>the newly inserted but as unposted Master record THEN would post the
>detail record and then finally perform an update on the Master
>record. In this way avoiding the missing Master record problem.

What happens to the TIBOTable under the hood is not 100% the same as what
happens to the native TIB_ components. But, on the surface, it does behave
as expected; so something is wrong with your setup there.


>I've put message statements for debugging purposes in all of the
>transaction's events - none of them fire and display my message.
>The onError event does fire.
>
>Have I totally misunderstood what's supposed to happen?

Seemingly a bit mixed up by using a smorgasbord of components at the
learning stage. Once you understand how the two architectures work and
differ, it is possible to make "hybrid" applications that use both
sets. Try to make it a bit easier for yourself by sticking to just one
kind before starting to add complexity.

Also, with client/server, you'll need to get rid of those table components.

I've done a couple of master-details demos for you: one using TIBOTables,
the other using TIBOQueries. There's a bit of "fluff" in there, too, using
a TIB_Cursor in an auxiliary transaction to load up some comboboxes, just
to show that there *are* situations where mixing TIBO and TIB_ will work
harmoniously.

Here's the link:
File : /TIBO_Master_Detail.zip
Uploaded by : helebor <helebor@...>
Description : 2 Master-detail demos using TIBO components

You can access the file at the URL:
http://groups.yahoo.com/group/IBObjects/files/TIBO_Master_Detail.zip

cheers,
Helen