Subject Re: [IBO] Field value
Author Helen Borrie
At 11:08 PM 16/10/2003 +0000, you wrote:
>if is a bug of ibo, i dont know
>the sampel code his hier
>
> //DestinationTable: TIBOTable;
> //Database1: TIBODatabase;
> //SourceTable: TIBOTable;
> SourceTable.active:=true;
> SourceTable.first;
> SourceTable.edit;

>// SourceTablePHONE_NO.asvariant:=null;

>// set null to colunm phone_NO for test

SourceTablePHONE_NO.Clear;

> // ///////////////SourceTable.Post; don't post anything
> // add record from sourcetable into destinationtable with field
>phonenumber = null
> destinationtable.insert;
> DestinationTableDEPT_NO.value :='950';
> DestinationTableDEPARTMENT.value :='Customer Support 1';

>// DestinationTableHEAD_DEPT.AsVariant:=NULL;

DestinationTableHEAD_DEPT.Clear;

> DestinationTableMNGR_NO.value :=SourceTableMNGR_NO.value;
> DestinationTableBUDGET.value :=SourceTableBUDGET.value;
> DestinationTableLOCATION.value :=SourceTableLOCATION.value;
> // use de property .text for demonstrate the problem
> // DestinationTablePHONE_NO.Text :=SourceTablePHONE_NO.Text;

Not valid, because you already cleared SourceTablePHONE_NO to null (which
you didn't need to do at all)
DestinationTablePHONE_NO.Clear;

> destinationtable.Post;
> if DestinationTablePHONE_NO.isnull then
> showmessage('hello world')
> else
> showmessage('wrong?');
> // after this while, see column Phone_NO in iboconsole, the value
>is '' (empty string) but this correct is Null
> // (or <null> in a data grid of iboconsole

Probably you need to understand NULL. It means "no value". So empty
string and NULL are different things. Empty string is "a string value of
zero length". NULL is a STATE in which the field has no value. You can't
treat it as a string because it isn't a string - it isn't anything.

Helen