BDE to Advantage conversion and Criteria
I have been trying to convert a host of user reports from the BDE to
Advantage. I can stream the reports to ASCII, make the changes and stream
them back into the template. I can make all the changes necessary with the
exception of the criteria. The BDE has "double quotes" around strings while
Advantage puts single quotes and sees double quotes as field references.
Without changing the criteria, the reports will not load.
Here is a simple example of an SQL statements. It's easy to search for
'.DB' and delete it, but it is another thing to search for double quotes
since they may be required with fields like Location."Key".
SELECT DISTINCT Location.Route,
FROM "Location.DB" Location
WHERE ( Location.Route IN ("PD","IRR","54AI","57AI","59AI") )
I've tried using TdaQueryDataView().SQL but can't seem to change the
database type using this method since I need to change TdaBDEQueryDataView
to TdaADSQueryDataView.
Any help would be appreciated. I have already downloaded
ConvertBinaryTemplateToASCII. Zip and EditTemplatesAsText.Zip but don't see
any help in this area.
Stan Reinke
Salt Creek Software, Inc.
Advantage. I can stream the reports to ASCII, make the changes and stream
them back into the template. I can make all the changes necessary with the
exception of the criteria. The BDE has "double quotes" around strings while
Advantage puts single quotes and sees double quotes as field references.
Without changing the criteria, the reports will not load.
Here is a simple example of an SQL statements. It's easy to search for
'.DB' and delete it, but it is another thing to search for double quotes
since they may be required with fields like Location."Key".
SELECT DISTINCT Location.Route,
FROM "Location.DB" Location
WHERE ( Location.Route IN ("PD","IRR","54AI","57AI","59AI") )
I've tried using TdaQueryDataView().SQL but can't seem to change the
database type using this method since I need to change TdaBDEQueryDataView
to TdaADSQueryDataView.
Any help would be appreciated. I have already downloaded
ConvertBinaryTemplateToASCII. Zip and EditTemplatesAsText.Zip but don't see
any help in this area.
Stan Reinke
Salt Creek Software, Inc.
This discussion has been closed.
Comments
Using the EditTemplateAsText example you could possibly load the template as
text and run it through a process that changes all double quotes to single
quotes. This is the method most of our customers use to convert thier
entire templates to a different format.
-------------------------------------------------
Tech Tip: Convert BDE Template Dataviews To ADO
-------------------------------------------------
Currently when DADE is used to create dataviews, the DatabaseName is stored
as part of the query definition. (This is consistent with Delphi's approach
to specifying a database connection for a Query object).
When you created the reports originally, the daDBBDE.pas BDE DADE plugin was
used. Now you want to use ADO. You've already changed the
Designer.Datasettings but this had no effect on the old reports. They still
try to use the BDE connection. Changing the Designer.DAtaSettings only works
for new dataviews that are created, because the new query dataviews are
using the daADO.pas ADO DADE plugin.
In order to convert the templates from BDE to ADO, at the minimum you have
to change the database name and the DADE plugin class names that are stored
in the templates. When a BDE dataview is created, its class type is a
TdaBDEQueryDataview. When an ADO dataview is created, its class type is
TdaADOQueryDataview. These class types are stored in the template. These
have to be changed before the template is loaded into a report.
First, compare a BDE report template to an ADO report template which both
connect to the same database table. Save a BDE and an ADO based report
template to separate ASCII text files. Now compare the dataview definitions.
Change the TdaBDEQueryDataview class name to TdaADOQueryDataview in the BDE
template. Change the BDE alias to your ADOConnection object. Then compare
the table name and field names of the BDE template to the ADO template and
change them accordingly, removing the .db extension on the table name is
necessary. Now load the converted BDE template in your ADO end user
application.
The first step is to make a backup of all your templates before continuing
with a programatic approach. You can convert the templates programatically
by loading the ASCII template files to a TStringList object. Then loop
through the lines of the list and change the text programatically. You can
loop through the files in a directory using ppFileUtils.pas calling the
GetFileNamesForDirectory procedure to load the file names.
If you have binary report templates, you'll also be able to convert these
with an extra couple of steps. You can load the binary template file into
ASCII format, modify it, and then save it back to binary as shown in the
example links below. Keep in mind the conversion is performed without
loading the report template into a TppReport.
This example shows how to load reports stored to the ReportExplorer database
tables and convert them to ascii text.
http://www.digital-metaphors.com/tips/EditTemplatesAsText.zip
This example shows how to convert an .rtm file to asii text
http://www.digital-metaphors.com/tips/ConvertBinaryTemplateToASCII.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com