Subject Re: [IBO] Fill field's value with it's default value at runtime
Author hiejoen
Comment below.

--- In IBObjects@y..., "Jason Wharton" <jwharton@i...> wrote:
> DefaultValue isn't intended to be used this way. If there is a
default value
> setting made then it will plug it in upon going into insert state.
If you
> are relying upon the servers defaults and you set GetServerDefaults
to true
> then it will query them in at time of going into insert state.
(NOTE:
> GetServerDefaults doesn't work perfectly for all types of defaults.)

It's not about GetServerDefaults. Let me explain in more details.

On myQuery (TIB_Query) I get server default value (Import Server
Defaults
item on popup menu)

I have in myQuery:
FieldA CHAR(1) NOT NULL VALUE IN ( 'T', 'F') DEFAULT 'F'
FieldB CHAR(1) NOT NULL VALUE IN ('T', 'K', ' ') DEFAULT ' '
FieldC DATE NOT NULL DEFAULT SOME_DATE
FieldD DATE (nullable)

If FieldA value is 'F' FieldB..FieldD should be fill with their
default
value.

On my form:
User fill FieldA with 'T', FieldB with 'K', FieldC with DATE1, FieldD
with
DATE2 but then he/she change FieldA to 'F' before save the record. So
I have
to change value of FieldB..FieldD to their default value. So I came
with my
TIB_Column.SetToDefaultValue implementation because I don't want to
remember
the data type of every fields (I have more then 3 fields in this
situation).

Any other way ? Thank's for your support.

HJ