Subject RE: [IBO] Problem sorting on Numeric(9,2) column-orderinglinks, ib_query
Author Michael Horne
Thanks for the code sample, but normally I setup the sorts by hand,
because I almost always have primary and secondary sort fields. But
this time I was creating a new screen and was in a hurry. So I used
the create button. But I think that is a bug to create it like that on
a numeric field if it is going to bomb when you try to sort on it.
Wanted to let Jason know about it.

Thanks
Michael Horne



_____

From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Dmitriy A. Beloshistov
Sent: Thursday, August 21, 2008 12:15 PM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Problem sorting on Numeric(9,2) column-orderinglinks,
ib_query



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@yahoogrou <mailto:IBObjects%40yahoogroups.com> ps.com
[mailto:IBObjects@yahoogrou <mailto:IBObjects%40yahoogroups.com> ps.com] On
Behalf Of guardian_yahoo@ <mailto:guardian_yahoo%40offroadeq.com>
offroadeq.com
Sent: Thursday, August 21, 2008 7:04 PM
To: IBObjects@yahoogrou <mailto:IBObjects%40yahoogroups.com> ps.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]







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