Subject Re: BLANKISNULL to All Columns
Author rogervellacott
I prefer that all null numbers and strings should be zeros and
blanks, and all zero dates should be null. So in the BeforePost event
of all our queries we call the following procedure, which you can
easily modify for your purposes. I am not sure this is what you
mean, but here it is FWIW.

procedure FixNulls(var Q:TIBOQuery);
//ensure any data aware controls are flushed to the query
for i := 0 to Q.FieldCount-1 do
if ((Q.Fields[i] is TNumericField) and
(Q.Fields[i].Value = Null)) then
Q.Fields[i].Value := 0
else if ((Q.Fields[i] is TStringField) and
(Q.Fields[i].Value = Null)) then
Q.Fields[i].AsString := ''
else if ((Q.Fields[i] is TDateTimeField) and
(Q.Fields[i].AsDateTime < OLD_DATE)) then

To make a field null, call its Clear method.

Replace the Q parameter with whatever dataset type you are using.

OLD_DATE is an application constant set to some date older than the
oldest possible date in the app. The comparison gets rid of zeros in
dates, which show as 30/12/1899.

--- In IBObjects@y..., "Martin D. Berezaga" <mdberezaga@y...> wrote:
> I'd like all columns in my application be setted to BLANKISNULL.
> I know I can set it at Domain Level in my IB_Connection, but I need
> setting be applicable to all columns, in all tables, regardless
Domains or
> DataTypes.
> Is there a way to do that?
> Thanks.
> ---------------------------
> Martin D. Berezaga
> mdberezaga@y...
> ICQ : 18537142
> Porto Alegre - RS - Brasil
> ---------------------------
> Yahoo! PageBuilder
> O super editor para criação de sites: é grátis, fácil e rápido.