Subject RE: [IBO] Lookup on Client table
Author Alan McDonald
> Hi All,
>
> Using IBO/FB I have two tables, master/client. Requestlive set to true
> on both.
> Both have PK fields. Client has FK field on master PK. PK fields are
> autogenerated (Using GeneratorLinks - a standard integer) fields for
> both tables.
> 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 is a
> required field for the client (there are 4 required fields in total).
> What I don't understand is why using INSERT seems to generate a POST -
> which is where I anticipate the error comes from as would be expected
> for a 'not null' field.
> 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 database.

Alan