Custom Report Wizard
I have an end user report solution built into a program I have written
and I'm having a bit of trouble. First, a bit of background:
The application was originally written in D4 using the BDE/Paradox with
ReportBuilder 6.x. It's now been redone in D7 using Advantage Database
with ReportBuilder 7.
I have a custom report wizard. Digital Metaphors provided the dfm and
pas files to which I added a small amount of code to add some text to
the "Limit Rows Returned" page, and also to preselect a table column in
the "Criteria" box. All of this works fine in both versions of the
program.
I also use table name aliases. In the old version of the program, I
could do, at any time, the action that would change the table alias, and
then when running the report wizard, the change would be reflected in
the first page of the wizard, where you are asked to "Select the tables
you want to query".
Now though, the alias doesn't change once the report wizard has been run
once. In other words, I can start the program, run the report wizard,
the initial alias is fine, close it, change the alias, restart the
report wizard but the alias hasn't changed. Or, I can start the
program, change the alias, run the wizard, the alias is fine here, close
the wizard, change the alias, restart the wizard, and the alias is
wrong.
I can't figure out what the problem is. I don't know if this is being
caused by moving from the BDE/Paradox to Advantage, or it's being caused
by using a wizard for RB 6.x in an RB 7 system. It just looks like the
query wizard is reading the alias information from the table only once.
Does anyone have any idea what might be causing this? Any help is much
appreciated! Thanks!
rob
and I'm having a bit of trouble. First, a bit of background:
The application was originally written in D4 using the BDE/Paradox with
ReportBuilder 6.x. It's now been redone in D7 using Advantage Database
with ReportBuilder 7.
I have a custom report wizard. Digital Metaphors provided the dfm and
pas files to which I added a small amount of code to add some text to
the "Limit Rows Returned" page, and also to preselect a table column in
the "Criteria" box. All of this works fine in both versions of the
program.
I also use table name aliases. In the old version of the program, I
could do, at any time, the action that would change the table alias, and
then when running the report wizard, the change would be reflected in
the first page of the wizard, where you are asked to "Select the tables
you want to query".
Now though, the alias doesn't change once the report wizard has been run
once. In other words, I can start the program, run the report wizard,
the initial alias is fine, close it, change the alias, restart the
report wizard but the alias hasn't changed. Or, I can start the
program, change the alias, run the wizard, the alias is fine here, close
the wizard, change the alias, restart the wizard, and the alias is
wrong.
I can't figure out what the problem is. I don't know if this is being
caused by moving from the BDE/Paradox to Advantage, or it's being caused
by using a wizard for RB 6.x in an RB 7 system. It just looks like the
query wizard is reading the alias information from the table only once.
Does anyone have any idea what might be causing this? Any help is much
appreciated! Thanks!
rob
This discussion has been closed.
Comments
1. Test the built-in report wizard for RB 7 and see whether that produces
the same result.
2. Where are you storing the table aliases? Are you using the RB Data
workspace to build queries using the query tools? Are you using the
DataDictionary?
3. Modify your Delphi library path from RBuilder\Lib to RBuilder\Source and
trace the code in the ppDsgner.pas unit for the methods:
TppDesignerWindow.NewReportFromWiz and WizardGetDataNamesEvent.
--
Nard Moseley
Digital Metaphors Corporation
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Tested with the built in wizard, it does produce the same result.
Table aliases are stored in a database table (and I've checked to make
sure the alias is correct in the table). In fact, I use a modified
version of the end user report demo program set up as an included unit,
not a stand-alone version that is called. There is no Join table or
datasource, but there is a TExtraDevices. Am using a DataDictionary.
Changed lib path to RBuilder\Source and set breakpoints on the two
methods. Execution did not stop at either.
1. The table and field aliases you stored in the DataDictionary tables are
used by the Query tools to build new queries, they are not used for existing
queries and they are not used by the report wizard (or anything in the
Design workspace).
2. If you modify the table/field alias stored in the database tables while
the application is running, you need to clear the meta data cache to see the
results. (see tech tip below).
3. Once the query dataview has been created, you can modify the name by
accessing the SQL tab of the query designer. Use the Fields tab of the query
designer to modify field aliases for the selected fields (or remove the
field and re-add it).
4. I ran the ReportWizard in the debugger and those methods fire for the
standard report wizard.
5. The Report designer provides the ReportWizard with a list of the
avialable datapipelines and fields, it build this list from the
pipeline/fields that you create in the data workspace. When I test here, I
can use the Data workspace to change the names and the result are reflected
in the standard report wizard.
----------------------------------------
Tech Tip: Clearing the Meta Data Cache
----------------------------------------
There is a global meta data cache that the ReportBuilder uses to cache
information about the available database tables and fields. You can clear
the meta data cache using the following code.
uses
daMetaDataManager;
begin
gMetaDataManager.Clear;
end;
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors Corporation
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Looks like the call to gMetaDataManager.Clear did the trick.
As an aside, I've been working with Delphi for over six years now, and
with Pascal in too many flavors since college. ReportBuilder is the
most enormously complicated (internally) tool I've used, but also the
best. And the support you guys provide in these newsgroups is the best
and most knowledgeable I've seen anywhere.
Thanks for all of your help.
rob