Subject Re: [IBO] Columnattributes T_YESNO=BOOLEAN=1,0 doesn't work if SQL contains "group by"
Author Helen Borrie
At 01:45 AM 3/11/2006, you wrote:
>Columnattributes T_YESNO=BOOLEAN=1,0 doesn't work if SQL contains
>"group by", however it DOES WORK of the SQL doesn't contain "group by"
>
>I am converting an extensive BDE application (not written by me).
>
>SQL.TEXT := 'Select account, posted, amount from DTRANS"
>ACCOUNT: TStringField
>POSTED: TBooleanField
>Amount: TBCDField
>
>if (Posted) then // compiles fine
>
>SQL.TEXT := 'Select account, posted, Sum(amount) from DTRANS"
>ACCOUNT: TStringField
>POSTED: TSmallIntField
>Amount: TBCDField
>
>if (posted) then // NOW needs to be changed to: if (posted = 1)
>
>The most recent grep indicates that the app contains over 400
>'occurances of the "group by" clause along with sundry associated .pas
>code. That's a lot to check and fix manually! Any assistance/comments
>appreciated. Thanks.

I see from your later posting that you are relying on database field
ColumnAttributes declared globally in the IB_Connection. That works
great for database fields and domains, but the output from a Group By
query is not database fields or domains but derived output, for which
the database has no metadata stored. For *any* derived field you
need to set its attributes directly in the dataset.

Note that, if you convert the specs of your grouped queries into
views, then the database *does* have the metadata stored. I'm not
*certain* that view definitions are domain-aware, though, so don't
treat this as an alternative workaround without testing it.

All that said and done, if you do plan to continue using explicit
persistent field objects in your converted application, you are not
stuck with the object type that Delphi guesses for you. You *can*
set the TField type yourself.

Helen