Subject Re: [IBO] Lookup on Client table
Author Tony Masefield
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
>
> Can you explain what you mean by "add a lookup to the client"?
>
Sorry for being obtuse, I mean an fkLookup field added using the
IBOQuery fields editor.

> Let's first get clear about what you're doing here. If you have
> implemented a master-detail relationship then the master record
must
> be posted before inserting a detail record can be allowed. So -
if
> you have actually inserted into the master record but that record
is
> not yet posted, then IBO posts the master record first, before
> putting the detail set into dsInsert. So, if anything, the
required
> entry FieldX is in the master record, not the detail. IBO is
aware
> of required fields and it won't let a Post proceed if any
> non-nullable fields are null. You're getting this error on the
> client side: this is BeforePost checking which IBO does to avoid
> incurring exceptions by posting blindly.
>
The master table entries ('Suppliers') are added sperately via a
seperate screen (window). Thus they are pre-existent to the detail
entry.
The Detail input screen ('Contacts') uses the pre-
existent 'Suppliers' table entries to enter supplier contacts
(detail table).

> It's not a question of a "workaround". Only to make sure that
> anything that has to be posted is ready to post. To provide a
> solution for the user, mark the required field in some way and
then
> be ready intercept the error if he decides to move on before
> finishing what he started. You can then send him a friendly
message
> like "Can't proceed until the compulsory fields are filled" and
hop
> the focus back to the first offending field.
>
> Helen
>
As mentioned, without the lookup field the app works fine, it's only
when one adds the lookup field that things go awry.
Master table PK field 'Supplier_ID' is autogen int.
(Master table (Suppliers) 'Supplier_Name' field is a required field)
Detail table 'Contact_ID' is autogen integer.
Detail table 'Supplier_ID' is FK field set to Master 'Supplier_ID'
on insert (by IBO).
Detail LookupField 'Supplier_Name' is based on:
LookupDataset -> Supplier
LookupKeyField -> Supplier_ID
LookupResultField -> Supplier_Name
KeyField -> Supplier_ID

The way I have structured things, having first to creat a
supplier 'profile' before a user can (seperate screen) add a contact
was done to prevent users trying to enter a contact before the
supplier entry was done. It's a system which I worked under (by
another programmer) as a user some years ago and I think is pretty
much fail-safe (at least so my experience goes). Maybe there's a
better way but resticting entry to one table at a time is the way
this sytem works. One cannot add 'detail' until the master 'profile'
is first entered. Maybe there's a better way?

Thanks for the time and effort Helen.

Regards