Subject RE: [IBO] Problem sorting on Numeric(9,2) column-orderinglinks, ib_query
Author Dmitriy A. Beloshistov
Hello!



I`m use following code for automatic add sorting in TIB_Query :



Type

TIB_QRSORTS=(qstDESC,qstASC);



Procedure SetFieldsSorting(SortType:TIB_QRSORTS; Q:TIB_Query);

const SortStr:array[TIB_QrSorts]of string[4]=('DESC','ASC');

var i:integer;

begin

with Q do

begin

OrderingItems.Clear; OrderingLinks.Clear; OrderingItemNo:=0;

if Prepared then

for i:=0 to Pred(Q.FieldCount) do

begin

if (Fields[i].FieldName<>'DB_KEY') and
(Fields[i].FieldName<>'RDB$DB_KEY') then

begin


OrderingItems.Add(Fields[i].FullFieldName+'='+Fields[i].FullFieldName+';
'+


Fields[i].FullFieldName+' '+SortStr[SortType]);


OrderingLinks.Add(Fields[i].FullFieldName+'='+IntToStr(I+1));

end;

end; // for

end; // with

end;



From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On
Behalf Of guardian_yahoo@...
Sent: Thursday, August 21, 2008 7:04 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Problem sorting on Numeric(9,2) column-orderinglinks,
ib_query



Hello,

I created a TIB_Query with the following SQL:

select * from PURCHASE_AM_Order

CREATE TABLE PURCHASE_AM_ORDER (
PAMO_ID integer not NULL,
PAMO_PART varchar(16),
PAMO_QTY integer,
PAMO_COST Numeric(9,2));

In the Ordering tab I clicked on the "Create" button
when I checked the Part, Qty, Cost, and clicked "OK",
said yes to "Assign ordering items?" Where it created
the following:

PAMO_PART=PAMO_PART;PAMO_PART DESC
PAMO_QTY=PAMO_QTY;PAMO_QTY DESC
PAMO_COST=PAMO_COST;PAMO_COST DESC

PAMO_PART=ITEM=1;POS=0
PAMO_QTY=ITEM=2;POS=0
PAMO_COST=ITEM=3;POS=0

If I go to data tab and click on the column header
to sort the "PAMO_COST" column I get an
"Integer overflow" error.

The way to solve this problem is to remove
the ";POS=0" from the line "PAMO_COST=ITEM=3;POS=0".

This seems to be a possible bug to me.

Thanks
Michael L. Horne



[Non-text portions of this message have been removed]