Subject [IBO] Re: DisplayFormat issue - EConvertError
Author Joe

Oops! Sorry, I misspoke. I am not using TIBO data access components. Ignore what I said about the TIBOFloatField. I was looking at an old component that I'm not using anymore.

Here is the DFM code for the table, DataSource, and the grid (Note: I've taken out the DisplayFormat setting because of the error, but if I put it back in, I start getting that error again)

object OrderItemsTable: TIB_Query
CalculateAllFields = True
CalculatedFields.Strings = (
DatabaseName = 'SMRDBS_MAN'
FieldsDisplayLabel.Strings = (
'ITEMPARTNO=Vendor Part #'
'ITEMTOTAL=Item Total'
'ITEMQTYBACK=# Backorder'
FieldsDisplayWidth.Strings = (
FieldsIndex.Strings = (
FieldsReadOnly.Strings = (
FieldsVisible.Strings = (
IB_Connection = TheDB
SQL.Strings = (
'select *'
' from orderitems')
OnCalculateField = OrderItemsTableCalculateField
AutoFetchAll = True
ColorScheme = False
KeyLinks.Strings = (
MasterSource = OrderDS
MasterLinks.Strings = (
MasterSearchFlags = [msfOpenMasterOnOpen, msfSearchAppliesToMasterOnly]
OrderingItemNo = 1
OrderingItems.Strings = (
OrderingLinks.Strings = (
RefreshAction = raKeepDataPos
RequestLive = True
AfterDelete = OrderItemsTableAfterDelete
AfterPost = OrderItemsTableAfterPost
BeforeEdit = OrderItemsTableBeforeEdit
BeforeInsert = OrderItemsTableBeforeInsert
BeforePost = OrderItemsTableBeforePost
OnNewRecord = OrderItemsTableNewRecord
BufferSynchroFlags = []
FetchWholeRows = True
Left = 238
Top = 461

object OrderItemsDS: TIB_DataSource
Dataset = OrderItemsTable
Left = 164
Top = 541

object OrderItemsGrid: TIB_Grid
Left = 8
Top = 236
Width = 776
Height = 101
CustomGlyphsSupplied = []
DataSource = OrderItemsDS
OnDblClick = OrderItemsGridDblClick
TabOrder = 34
OnExit = OrderItemsGridExit
GridLinks.Strings = (



The only event handler that I can see that could possibly trigger an error like this would be OnCalculateField, since the error occurs when simply scrolling to the record. As you can see in the above DFM, the only other ones defined are AfterDelete, AfterPost, BeforeEdit, BeforeInsert, BeforePost, and OnNewRecord, none of which would get triggered by just scrolling to the record. Below is my code for OnCalculateField, but I don't see anything wrong with it.


void __fastcall TMainForm::OrderItemsTableCalculateField(
TIB_Statement *Sender, TIB_Row *ARow, TIB_Column *AField)
ARow->ByName("ItemTotal")->AsFloat = ARow->ByName("ITEMCOST")->AsFloat * ARow->ByName("ITEMQTYORDERED")->AsFloat;
ARow->ByName("ItemRetailTotal")->AsFloat = ARow->ByName("ItemRetail")->AsFloat * ARow->ByName("ITEMQTYORDERED")->AsFloat;


Any other ideas?


--- In, Helen Borrie <helebor@...> wrote:
> At 05:07 AM 22/11/2010, Joe wrote:
> >Anyone???
> >
> >Even if you don't know why I'm getting the error I'm getting, I would really appreciate it if someone could point me to the documentation that explains the syntax for DisplayFormat.
> >
> >-Joe
> >
> >--- In, "Joe" <joe@> wrote:
> >>
> >> I am trying to use the DisplayFormat attribute to display a numeric value as curency (i.e. $12.33) in a TIB_Grid. The grid is attached to a TIB_Query.
> >>
> >> I set the DisplayFormat to: $###,###,##0.00
> >>
> >> When I have it set like that, if the grid attempts to display a value that has cents in it (that is, not a whole number), I get the following exception: "Project MYPROJECT.exe raised exception class EConvertError with message "1.45" is not a valid integer value"
> >>
> >> If I remove the DisplayFormat setting, I don't get the exception.
> >>
> >> The field in question is defined as a TIBOFloatField.
> >>
> >> Did I set the DisplayFormat incorrectly?
> It looks correct for FormatFloat...but I suspect you are getting problems from trying to use TIBO data access components with the TIB_ controls. They are not compatible.
> Helen