Subject Re: [IBO] Columns information
Author Helen Borrie
At 02:29 PM 28-03-01 -0500, you wrote:
>Hi,
>
>I am trying to gather information on columns. I have found several places to get some info but I am still missing the field type and size. I am trying to work at the TIB_BDataset level. FieldDefs[] does not seem to be accessible.
>
> for I := 0 to Dataset.Fields.ColumnCount -1 do
> begin
> memo1.Lines.Add(Dataset.Fields.Columns[i].FieldName);
> memo1.Lines.Add(Dataset.Fields.Columns[i].DisplayName);
>
> end;

Fields[n] accesses a TIB_Column, which is a merging of both the TField and TParam concepts of the VCL. Look at the properties of TIB_Column - you will find everything you need there. Note that the dataset must be prepared to access Fields[], otherwise you will get an AV at run-time. You can also access its props using Fields['ColumnName'] or FieldByName('ColumnName').Property.


>What i am missing is the type (char,int,num,boolean...) and size.

FieldByName('ColumnName').SQLType
FieldByName('ColumnName').Datasize or FieldByName('ColumnName').SQLLen

>I want to dismiss BLOB, BINARY and setup an editbox mask/validation according to the type of data.


>And if possible to get the value used for booleans.
FieldByName('ColumnName').BooleanFalse and FieldByName('ColumnName').BooleanTrue.

FieldByName('ColumnName').Value is a variant.

Cheers,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________