Subject | Re: [IBO] Lookup on Client table |
---|---|
Author | Tony Masefield |
Post date | 2006-10-08T15:13:43Z |
--- In IBObjects@yahoogroups.com, "Alan McDonald" <alan@...> wrote:
exists but hitting INSERT on the detail table gives the error prior
to trying to post. This only occurs if the Detail table fkLookup
field is set to type lookup in the fields editor (which it should
be). Removing the fklookup field the app works (one can enter the
required and other fields). The FK field is set to the Master PK
field and the autogenerated PK detail field is filled in by the
generator.
All cool until I try add an fkLookup filed which references (via the
FK detail field) the PK field of the master to provide the (in this
case) 'Supplier_Name' field of the master as the 'ResultField'.
there is no explicit post, just an insert. An error is returned
which says 'FieldX (a 'Not Null' field) is required' - which seems
that this technique is trying (some way or another) to execute an
imlicit POST when INSERT is hit.
As mentioned, without the lookup field in the detail all's fine and
behaviour is as expected.
The lookup field in the master is, in reality, just a 'label' for
the detail table ('Supplier Contacts'). The master is diplayed as a
grid and the detail as a 'Card View' - like DBCtrlGrid but based on
Express QuantumGrid if you are familiar with this component.
Thanks for the help, especially on Sunday (working day here though).
Regards,
>to true
> > Hi All,
> >
> > Using IBO/FB I have two tables, master/client. Requestlive set
> > on both.are
> > Both have PK fields. Client has FK field on master PK. PK fields
> > autogenerated (Using GeneratorLinks - a standard integer) fieldsfor
> > both tables.is a
> > Everything works according to plan.
> >
> > If I add a lookup to the client based on it's FK refering to
> > the 'SupplierName' mastertable field I get a "Field X must have a
> > value" when attempting an insert on the client - where Field X
> > required field for the client (there are 4 required fields intotal).
> > What I don't understand is why using INSERT seems to generate aPOST -
> > which is where I anticipate the error comes from as would beexpected
> > for a 'not null' field.database.
> > Suggestions/workaround?
> >
> > Regards
>
> in your AfterInsert event, give the required fields a value
> E.G.
> IB_Dataset.FieldByName('ID').AsInt64 :=
> IB_Dataset.Gen_ID('GEN_ERATOR_ID',10);
>
> FKs are allowed to be NULL if you make them nullable on the
>Hi Alan, we may be talking at cross purposes. The master record
> Alan
>
exists but hitting INSERT on the detail table gives the error prior
to trying to post. This only occurs if the Detail table fkLookup
field is set to type lookup in the fields editor (which it should
be). Removing the fklookup field the app works (one can enter the
required and other fields). The FK field is set to the Master PK
field and the autogenerated PK detail field is filled in by the
generator.
All cool until I try add an fkLookup filed which references (via the
FK detail field) the PK field of the master to provide the (in this
case) 'Supplier_Name' field of the master as the 'ResultField'.
there is no explicit post, just an insert. An error is returned
which says 'FieldX (a 'Not Null' field) is required' - which seems
that this technique is trying (some way or another) to execute an
imlicit POST when INSERT is hit.
As mentioned, without the lookup field in the detail all's fine and
behaviour is as expected.
The lookup field in the master is, in reality, just a 'label' for
the detail table ('Supplier Contacts'). The master is diplayed as a
grid and the detail as a 'Card View' - like DBCtrlGrid but based on
Express QuantumGrid if you are familiar with this component.
Thanks for the help, especially on Sunday (working day here though).
Regards,