Subject Re: Field value required - MIDAS
Author Guillaume JUSTIER
Thanks you very much Helen for your answer.
I changed the autogenerated value back to arNone on the server side. as you suggested
I can now insert a row in the clientdataset, post it and apply the data.
However, now I cannot post two rows after one another as I get a key violation. I believe
it is because the client side is not aware of the generator/trigger on my primary key.
the trigger BEFORE INSERT looks like this :
if (NEW.TEST_PK IS NNULL) THEN
NEW.TEST_PK = GEN_ID(GEN_TEST_PK,1)

On the server side, on the TIBOQuery, I have set the generator link to :
TEST_PK=GEN_TEST_PK.

But it doesn't seem to be enough. I understand it makes sense since the client doesn't speak to the server
before an apply. Therefore two inserts after one another would fail.

Is it a design problem or is there a simple solution ?
Thnaks in advance.
Guillaume

>Hi All,
>I have, I am sure a simple problem :
>Client server application using IBOBJECTS and MIDAS/MTS.
>Table TEST :
>field TEST_PK integer not null
>field TEST_DATA integer
>trigger before_insert
>generator GEN_TEST_PK

If setting the Required property in the Delphi Object Inspector (when the persistent field object is selected in the Delphi Fields Editor) doesn't work, then access the IBO InternalDataset.ColumnAttributes in the BeforePost event and set it there, viz.

MyDataset.InternalDataset.ColumnAttributes.LinkValues['TEST_PK'] := IB_NOTREQUIRED;

>I then create a test client app with just one dbgrid.
>I cannot create a row if I don't put the value of the primary key myself. (I get "Field value required)
>I set up the generator on the IBOQuery on the DELPHI server side.
>I tried to change the properties "required", "autogeneratedvalue", "required" on the CLient Dataset but it still doesn't work.

Don't set AutogenerateValue to arAutoinc because a generator is not an Autoinc type. Leave it arNone.

>I believe the problem is on the client side as I don't think my insert ever goes to the server.

What is the code for your Before Insert trigger?

Regards,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________





[Non-text portions of this message have been removed]