Subject Re: [IBO] Display format in a varchar field
Author Helen Borrie
At 09:03 AM 9/10/2009, Andrei Luis wrote:
>I'm using IBO 4.8.7 and FB 2.1.2 on Delphi Pro 2006.
>I'm stuck with a silly issue. I already searched in old messages, but didn't
>find anything related to display format with varchar field.
>Consider a varchar(11) field, I want to store an eight string on it (the
>remain characters is reserved for future needs), like '12345678'. I'd like
>to show this value with a mask like this: '1234.5678'.
>I tried to put 0000.0000;1;X (where X is a blank character), in Display
>Format field, in the proper table field of my IB_Query, but the field is
>displayed as '1234.' when the stored value in DB is 12345678.
>Instead of that, I put 0000.0000;1;X in Edit Mask on IB_Query, now the field
>is properly shown, but the '.' is stored in DB, what I don't want.
>I need to show the formmatted field in TIB_Edit and TIB_Grid, and the
>content of it will be numbers only.
>So, to abbreviate the question, how can I display a string field formmatted
>as '0000.0000', and edit/store it in db without the mask?

Use the FieldsDisplayFormat property of the field in your IB_Query - I think you are referring to that in your reference to "Display Format field", above. For strings, the Delphi property syntax to use is that prescribed for the FormatMaskText() method.

Probably for this case (not tested) the syntax you want is similar to the one you tried, except that (a) you omitted the obligatory backslash preceding the literal period character and (b) you supplied 1 in the second argument when you actually need to have 0 there:


The third argument will cause the letter 'X' to appear when the input is shorter than the mask. So, e.g., input '123456' will display '1234.56XX'