Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Autoinc and Required Issue
Thu, Feb 1 2018 12:06 AMPermanent Link

John Easley

We are upgrading tables from DBISAM 3.30.

I'm using 4.44 Build 3 and have the following issue.

My upgraded table is configured with an Autoinc field called 'InvoiceID', and the Required setting is set to True.

When posting a record as simple as

tInvoices.append;
tInvoices.fieldbyname('Amount').asfloat := 1.00;
tInvoices.post;

A DBISAM exception is raised, 'field InvoiceID  must have a value'

If I create a brand new table in 444.B3, it works as expected.

TIA,

John
Mon, Feb 5 2018 1:44 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

John,

<< We are upgrading tables from DBISAM 3.30.

I'm using 4.44 Build 3 and have the following issue.

My upgraded table is configured with an Autoinc field called 'InvoiceID', and the Required setting is set to True.

When posting a record as simple as

tInvoices.append;
tInvoices.fieldbyname('Amount').asfloat := 1.00;
tInvoices.post;

A DBISAM exception is raised, 'field InvoiceID  must have a value' >>

What you're seeing there is the TDataSet class functionality for required TFields throwing an exception, not DBISAM.  In order to fix this, just set the Required property of the TField to False:

a) If you're using persistent TFields, then just use:

MyTableAutoIncField.Required:=False

b) If you're using dynamic TFields (the default), then just use:

MyTable.FieldByName('AutoIncField').Required:=False

You can do either of these at any time after the table is opened, but the persistent fields version can be done at design-time also.

Tim Young
Elevate Software
www.elevatesoft.com
Image