Subject Re: [IBO] Still having problems with OnCalculateField
Author Nando Dessena

S> maybe I'm not explaining myself very well here.

yes you did.

S> we have FORENAME as a CHAR (15) and SURNAME as a CHAR (30). If we
S> store the following information in these 2 fields:

S> FORENAME="Stuart"

S> then have a TIB_Query that returns both these fields - i.e.

S> if you do:
S> ShowMessage(IB_Query.FieldByName
S> ('FORENAME').AsString+' '+IB_Query.FieldByName('SURNAME').AsString)
S> then it (correctly) returns:
S> "Stuart Hunt".

my point is that it's NOT correct. CHAR fields are padded at the
server by definition, and shouldn't be trimmed by the client framework
unless it's told to do so.

If you have chosen CHAR instead of VARCHAR, you should have done so on
purpose, to have padded values. It looks like you expect VARCHAR-type
behaviour, which will bite you sooner or later. Even if IBO does trim
the values (which is the thing I am questioning right now) you're
gonna have problems the first time you do A || B in a trigger or stored

S> then put the following code into the OnCalculateField event:
S> ShowMessage(ARow.ByName('FORENAME').AsString+' '+ARow.ByName
S> ('SURNAME').AsString);
S> then it (incorrectly) returns:
S> "Stuart Hunt "

again, my point is that it's correct. :-)

S> in other words, in this event (and it seems only in this event) the
S> AsString method is padding the field out to its maximum width.

I guess it depends on how one sees things. My view is that it's
trimming in the other cases, not that it's not padding in this case.
That's why I'd want to hear what Jason has to say.

Nando mailto:nandod@...