Subject | Re: [IBO] How set default to blank string? |
---|---|
Author | Geoff Worboys |
Post date | 2001-11-07T08:24:24Z |
> I ended up using an OnNewRecord event in my data moduleGood to hear you found a solution you are happy with.
> to handle the default fields. I just rather do that than
> add DB triggers to check and adjust. There are other
> fields with defaults that can only be set in the
> client so I might as well do them all there.
I see the setting of null string fields to blank as a specific
requirement in itself - quite separate from wanting a "default" value.
By doing this in the triggers I can be sure that there are no null
string fields in my table and therefore any stored procedures that I
write can assume a non-null value. This allows code like...
SomeVariable = AStringField || '.' || BStringField;
instead of very messy...
IF( (AStringField IS NULL) AND
(BStringField IS NULL) ) THEN
SomeVariable = '.';
ELSE
IF( AStringField IS NULL ) THEN
SomeVariable = '.' || BStringField;
ELSE
IF( BStringField IS NULL ) THEN
SomeVariable = AStringField || '.';
ELSE
SomeVariable = AStringField || '.' || BStringField;
If you are content with your solution that is great. Just be careful
if you or anyone else ever edits/inserts fields from IB_SQL or some
other utility.
Geoff Worboys
Telesis Computing