Filter a Paradox table on a Logical field

Filter a Paradox table on a Logical field

Post by Mauro Volpa » Thu, 07 Dec 1995 04:00:00



Hi, folks
Somebody can tell me how filter a Paradox table (inside Delphi ofcourse) on a
logical field?
e.g. to display in a DBLookupCombo a subset of a lookup table based on a state
of a logical field.
Thanks
Mauro
 
 
 

Filter a Paradox table on a Logical field

Post by Steve Koters » Sat, 09 Dec 1995 04:00:00




Quote:>Somebody can tell me how filter a Paradox table (inside Delphi ofcourse) on a
>logical field?
>e.g. to display in a DBLookupCombo a subset of a lookup table based on a state
>of a logical field.

Ordinarily, one would use the SetRange method of the TTable component to
filter the data. However, this requires an index on the filter field and
with Paradox tables it is not possible to base an index on a Boolean field.

One alternative might be to convert that Boolean field into a String field.
You would still be able to connect a TDBCheckBox component to it, you would
be able to use it like a Boolean field by typecasting it, and you would be
able to base an index on it.

**************************************************************************
Steve Koterski
Product Group Manager
Delphi Technical Support
Borland International, Inc.

 
 
 

1. Accessing logical fields in paradox tables via ODBC

I am trying to access a paradox database, containing logical fields,
via ODBC. However attempting to bind a parameter to a logical field
requires a long integer data type as there appears to be no logical
SQLDataType. The LongInt type is dictated by the underlying data type
in the Paradox table structure being four bytes. Surely this is wrong
as this is database specific and will fail if I then move the tables
to a database in which the underlying type is not four bytes.

Also there appears to be a problem in retrieving values using queries
based on a logical field;

e.g.
        'SELECT FldVal, FldBool from ATable Where FldBool = true'
works, but
        'SELECT FldVal, FldBool from ATable Where FldBool = :QryBool'
fails to find any true records if the query condition is defined as;
        FldBool := LongInt(True);
even though using the first case shows LongInt(true) and ColLongInt[2]
to both evaluate to 1. Queries on false values in the fields work in
both cases. To get this to work for true values it appears to be
necessary to set FldBool := -1, but again this is tied to the
underlying representation of a true value in the Paradox database
structure.

This is all implemented using Paradox 5 tables under Paradox 7 and the
microsoft paradox drivers (3.51.171300 / MDAC 2.0) with test code in
Delphi 3 using ODBC Express v 4.53.

What am I doing wrong here? How do I remove the explicit connection to
the underlying types and values in a database?

Jarvis N. Brand


2. Beginner question

3. Help! How do I get Record Count?

4. filter and logical field

5. Change to "binary sort order" prevent SQL login, Help!

6. Unable to set logical field default value to False in Paradox 7

7. Duplicate database.....

8. Paradox LOGICAL fields

9. Logical queries on Paradox 5.0 memo fields

10. grouping on a logical field in Paradox 7

11. date fields in Paradox 5.0 filters

12. Filtered Paradox Table and the DBGrid