Home DADE
New Blog Posts: Merging Reports - Part 1 and Part 2

Selecting paradox from different directories

edited December 2002 in DADE
BDE queries support querying paradox tables from different directories,
e.g.:

SELECT tb1.*
FROM
Table1 tb1 INNER JOIN "C:\Temp\MyApp\TmpSeltable1" tb2 ON tb1.Id = tb2.Id
ORDER BY
tb2.Order

How can I do this in a dataview? In my app, if the user wants to print a
selection of (filtered) records, a temporary table is made with the keys and
ordering of the desired records. This temp table is made in a local dir, so
I have to join with a table in a different directory.

Previously I did this by manipulating the SQL statement after loading the
report, by setting the EditSQLAsText property of the TdaSQL object to true
and then replace a stubb table name with the actual selection table. But if
I do this with linked tables, it breaks the link. Now I try to replace the
tablename inside the .RTM before it is loaded, but that doesn't work,
because RB strips the path from the tablename on loading.

How should I do this?

Peter Laman,
Lance ICT, Roermond, the Netherlands
http://www.lance.nl

Comments

  • edited December 2002
    You'll have to edit the SQL object before the report prints in order to add
    the path name to the table in the SQL. DADE doesn't support multipl
    edatabase connections at one time. You will need to do what you were doing,
    extract the SQL object, set EditSQLAsText to true and change the SQL.
    Editing the SQL text will break the linking logic because the linking logic
    is based on the SQL object's properties. The SQL object doesn't know how to
    parse the SQL, it can only generate SQL.

    Wouldn't it be easier to use a single Paradox/BDE database that your app
    uses and apply search criteria at runtime in DADE. This way you can keep the
    linking logic, but use DADE's search capability. Apply the "filter" by
    extracting the SQL object and creating a criteria at runtime to effectively
    filter the records on the main database, instead of trying to join to a
    temporary table in another directory. The ExtractSQLObject tip shows how to
    add a criteria object.
    http://www.digital-metaphors.com/tips/ExtractSQLObject.zip

    Another thing to consider is to NOT use Paradox or the BDE. There is a list
    of BDE alternatives on our website: www.digital-metaphors.com


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited December 2002
    Jim,

    Switching to another database is not an option at this moment. We're talking
    about an old 16 bit Delphi 1 app (with RB 3), that we're porting to D6 and
    the customer is waiting. We simply don't have the time to switch to another
    database or engine.

    The filtering applied to the main table in the app is very specific, based
    on calculations made with BDE callback filters and it cannot be expressed in
    local SQL. That's why I need those temp tables.

    With RB 3, the same technique was used and it didn't break the links, so I'm
    afraid I really have a problem here...?

    Peter
This discussion has been closed.