Subject Re: [IBO] Default Values
Author Lucas Franzen
Ben,

ben_sollis schrieb:

> Hi all..
>
> In my db I have various domains. One of these being a Y/N defaulting
> to Y.
>
> When trying to insert records, the inserts fail saying the column
> contains no data.
>
> if I modify the OnBeforeInsert function and hard code a default
> value, everything works fine.

IBO doesn't fetch the default values from the server by default.
So it doesn't know about the default values when you're psoting. And
leaving a field value NULL will NOT supply a default value, since the
field will be part of the insert statement that's sent to the server.
Default values will only be applied by the db engine if the field is NOT
part of the insert statement.

What you can do is (if you're queries are bount to a TIB_Connection):

set the TIB:_Connection property of FieldentryTypes->fetDomainNames to
TRUE - this will cause the connection to retrieve the DomainNames from
the db after connecting.
For all domains you want to be automatically be "defaulted" make an
entry in the DefaultValues property (editor), like:
MY_DOMAIN=DEFAULTVALUE

in your case,

MY_BOOL_NO=N
MY_BOOL_YES=Y

I'm not sure which way this works with IBOQ... but I'm pretty sure there
are properties like this, too.

If you use native components and IB_Grids and you automatically want
Boolean values be represented by a checkbox or a checkmark (if set to
true) you can also make an entry into the ColumnAttributes property like:
MY_BOOL_NO=BOOLEAN=1,0
MY_BOOL_YES=BOOLEAN=1,0


Luc.