Subject Re: [IBO] Converting BDE to IBO
Author Andrei Luís
Hi Helen,

Answers below.

2005/11/4, Helen Borrie <helebor@...>:
> At 10:18 AM 4/11/2005 -0300, you wrote:
> >2005/11/4, Helen Borrie <helebor@...>:
> > > At 09:41 AM 4/11/2005 -0300, you wrote:
> > > >Hi Helen,
> > > >
> > > >CREATE DOMAIN BOOLEAN AS
> > > >CHAR(1) CHARACTER SET WIN1252
> > > >DEFAULT 'N'
> > > >CHECK (value in ('N', 'S'))
> > > >COLLATE WIN1252
> > > >
> > > >I do the tests with two fields. One using the domain above, and other
> > > >field without domain. The result was the same: both 'N' (false) and
> > > >'S' (true) are handle as false!!! Tried with 'T' and 'F', and didn't
> > > >works too.
> > > >
> > > >I don't know what is happen.
> > >
> > > Do you have these properties set in your DBCheckBox?
> > >
> > > DBCheckBox1.ValueChecked := 'S';
> > > DBCheckBox1.ValueChecked := 'N';
> > >
> > > I don't think TDBCheckBox is specifically for Boolean pairs like
> > > TIB_CheckBox is...
> >
> >Just changed that properties and still didn't work.
>
> Sorry for the typo, it should have been:
>
> DBCheckBox1.ValueChecked := 'S';
> DBCheckBox1.ValueUnchecked := 'N';

I already had did that before u wrote that.

>
> >I used a lot of
> >TDBCheckbox with Paradox, and it always works fine with boolean
> >fields. As I concern it is specially made for this.
>
> I think there might be something peculiar about your data. Perhaps you
> should not define your domain with a COLLATION clause?
>
> Would you try it with a test table using a differently defined Boolean
> domain, with no specific charset or collation?

That Create Domain command I extracted from metadata. I tried to
create a domain with the below command:

CREATE DOMAIN S_BOOLEAN AS
CHAR(1) DEFAULT 'N'
CHECK (value in ('N', 'S'))

After that, I looked in metadata again, and character set and collate
where auto-defined. I feel like this is a default in Firebird?

> Where character sets are involved, I think it would be better to use
> smallint for your Boolean columns and constrain them to be 1 and 0. This
> way you will avoid the effects of variations in lower/upper case mappings
> in the collations and also situations where users might enter lower case
> characters.
>
> could you defne a domain like:
>
> create domain d_boolean2 as smallint
> default 0
> check (value is not null and value in (1,0));

Did that, and... still didn't work...

I don't know what I am doing wrong...

I got another answer at www.firebase.com.br, simple, and I think it
will solve the problem:

It consists using a char(1) field, and values 'T' and 'F'. Whenever
need to do a boolean comparison, I do like this
iboTable1MyFakeBoolean.asBoolean=True

I think that with this clue and using DBCheckBox1.ValueChecked := 'T'
and DBCheckBox1.ValueUnchecked := 'F' it should solve my problem.


I don't know what is going wrong with the clues I got here with you
all, and I can't spend more time with this issue, so if anything goes
wrong, I will use calculated fields.

Thanks to all
Andrei