The SetRange paradox does not give the correct result when querying three fields

I have a problem setting the range for a secondary index in a Paradox 7 table using Delphi2010.

Relevant fields:

FeatureType (int); YMax (int); XMax (int); YMin (int); Xmin (int). The secondary index contains all of these fields in that order.

I tested using the SetRange statement as shown below (optional to add all field values, the rest is assumed to be NULL and all values ​​are included):

table1.IndexName := 'YMaxIndex';
table1.SetRange([101, 280110400],[101, 285103294]); //386236 records

And tried to get the result 0, adding to the restrictions:

table1.IndexName := 'YMaxIndex';
table1.SetRange([101, 280110400, 1],[101, 285103294, 1]); //386236 records

But it still gets 3863236, which is clearly wrong when checking the values ​​in the XMax field in the table.

Can someone explain to me that I do not understand about the Paradox and SetRange index? I often used similar code, but not necessarily with 3 fields indicating a range.

Update

. Uwe . ( XMax):

Table1.SetRange([101,280110400], [101,285103294]);
Table1.Filter := 'XMax > 100000 and XMax < 110000';
Table1.Filtered := true; 
+3
3

. , . .

, FeatureType 101..101. 101, . , .

YMax 280110400..285103294 (280110400 285103294), . .

, , - SQL Select.

+4

, table1.SetRange([101, 280110400, 1], [101, 285103294, 1]); Folow

  • 101 280110400 1
  • 101 280110400 2
  • 101 280110400 3
  • ....
  • 101 280110401 -maxint
  • ....
  • 101 280110401 maxint
  • ....
  • 101 285103294 0
  • 101 285103294 1
+2

:

SetRange , ,

SetRange ([1,2], [2,2])

(1, 3);

: 1 = 1 (), (2 < 3) - .

End range: we have 1 <2 for the first field (not the border), so the second field is not checked - the final condition of the range is fulfilled.

Recording is in range.

+1
source

All Articles