Subject | Re: [IBO] Appending & Required Fields |
---|---|
Author | Christian Mautendorfer |
Post date | 2003-08-20T17:02:11Z |
IBO can't know that a trigger is taking care of that so of course it
complains :)
You have 2 options to take care of the "problem".
1. Remove the required option from the field in IBO (can be done over the
TIB_Query dialog)
this has the disadvantage that IBO "looses" the record since it can't know
what the ID was set to and
so can't manage it anymore unless you refresh all keys.
2. Set a generator link: <tablename>.PLAN_ID=<GeneratorName>
and make sure you are testing the value for null in the trigger so you
don't overwrite it afterwards.
Trigger example:
if (new.PLAN_ID is null) then new.ID=Gen_id(Gen_PLAN_ID, 1);
BTW: generator links can be set at the connection level so if you use a
single table with multiple TIB_Queries it
only has to be set once
regards
Chris
At 16:53 20.08.2003, you wrote:
--Chris
complains :)
You have 2 options to take care of the "problem".
1. Remove the required option from the field in IBO (can be done over the
TIB_Query dialog)
this has the disadvantage that IBO "looses" the record since it can't know
what the ID was set to and
so can't manage it anymore unless you refresh all keys.
2. Set a generator link: <tablename>.PLAN_ID=<GeneratorName>
and make sure you are testing the value for null in the trigger so you
don't overwrite it afterwards.
Trigger example:
if (new.PLAN_ID is null) then new.ID=Gen_id(Gen_PLAN_ID, 1);
BTW: generator links can be set at the connection level so if you use a
single table with multiple TIB_Queries it
only has to be set once
regards
Chris
At 16:53 20.08.2003, you wrote:
>I have a pretty simple table with an ID and a name. In the BI trigger I--
>assign a value to the ID from the generator. But in my source code I am
>just trying to append a record:
>
> ibqPlans.Append;
> ibqPlans.FieldByName('PlanName').AsString := 'Test';
> ibqPlans.Post;
>
>I get an exception back:
>
>---------------------------
>Project1
>---------------------------
>PLAN_ID is a required field.
>---------------------------
>OK
>---------------------------
>
>I am using a TIB_Query for the assignment. Why is it wanting me to
>assign the PLAN_ID value?
>
>Thanks
>
>Thanks
>Ed Dressel
>
--Chris