Subject Re: [IBO] blank as default value for char fields
Author Paul Vinkenoog
Hello Safak,

> How can I configure the property "Default Value" of the fields of
> TIBOQuery to pleace space [ chr(32) ].

I'm not sure if you can. If you place an entry in DefaultValues like
this:

'MyField= '

...the space will *probably* get trimmed to an empty string (if you
use a TIB_Query instead, you can prevent this by setting the trimming
for that field to None). You should try it, though.

If that doesn't work, you can use one of the following methods:

a) Create an AfterInsert handler for your TIBOQuery with this line:
MyQuery.FieldByName( 'MyField' ).AsString := ' ';

b) Create a before insert trigger in your database for the table in
question with this line:
if ( New.MyField is null ) then New.MyField = ' ';

Depending on how you use the query, (a) might be better because in
that case IBO knows the correct field value. With (b) the NULL ->
Space conversion takes place _after_ the record is posted, so IBO
knows nothing about it.

(You can also do both, by the way...)


Greetings,
Paul Vinkenoog