Subject | Re: [IBO] blank as default value for char fields |
---|---|
Author | Paul Vinkenoog |
Post date | 2004-02-15T00:21:45Z |
Hello Safak,
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
> How can I configure the property "Default Value" of the fields ofI'm not sure if you can. If you place an entry in DefaultValues like
> TIBOQuery to pleace space [ chr(32) ].
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