Data Design
I've built a wizard for creating reports. This wizard is generic in that
it could act as a front end to any reporting engine - RB, Rave, Crystal,
etc. The end result is a data structure that describes a generic report.
So far so good.
My next step is to take that generic data structure, and create a RB
report from it. I've been successful in this by using the example in the
Developer's Guide entitled "Creating Reports in Code" (page 83).
However, I would like the user to be able to fine tune the report by
using the TppDesigner component. This is where I'm lost. My guess is
that I have to:
1. Create a ADO Connection for the database.
2. Somehow tell the TppDesigner component to use that database.
3. Add the tables listed in the generic data structure to the SQL object
in the report.
4. Add fields, joines, criteria, etc to the SQL object.
Am I on the right track? This is what I have so far:
var
designer: TppDesigner;
cnc: TADOConnection;
begin
cnc := TADOConnection.Create(nil);
cnc.ConnectionString := 'Provider=OraOLEDB.Oracle.1;Data
Source=db;User ID=userID;Password=password';
cnc.Name := 'dbConnection';
cnc.LoginPrompt := false;
cnc.Open;
designer := TppDesigner.Create(nil);
try
designer.AllowDataSettingsChange := true;
designer.DataSettings.AllowEditSQL := true;
designer.DataSettings.CollationType := ctANSI;
designer.DataSettings.DatabaseName := 'dbConnection';
designer.DataSettings.DatabaseType := dtOracle;
designer.DataSettings.SessionType := 'ADOSession';
designer.DataSettings.SQLType := sqSQL1;
designer.DataSettings.UseDataDictionary := false;
designer.AllowSaveToFile := false;
designer.Report := TppReport.Create(nil);
designer.ShowModal;
finally
designer.Free;
end;
end;
Thanks in advance,
Ed Vander Hoek
it could act as a front end to any reporting engine - RB, Rave, Crystal,
etc. The end result is a data structure that describes a generic report.
So far so good.
My next step is to take that generic data structure, and create a RB
report from it. I've been successful in this by using the example in the
Developer's Guide entitled "Creating Reports in Code" (page 83).
However, I would like the user to be able to fine tune the report by
using the TppDesigner component. This is where I'm lost. My guess is
that I have to:
1. Create a ADO Connection for the database.
2. Somehow tell the TppDesigner component to use that database.
3. Add the tables listed in the generic data structure to the SQL object
in the report.
4. Add fields, joines, criteria, etc to the SQL object.
Am I on the right track? This is what I have so far:
var
designer: TppDesigner;
cnc: TADOConnection;
begin
cnc := TADOConnection.Create(nil);
cnc.ConnectionString := 'Provider=OraOLEDB.Oracle.1;Data
Source=db;User ID=userID;Password=password';
cnc.Name := 'dbConnection';
cnc.LoginPrompt := false;
cnc.Open;
designer := TppDesigner.Create(nil);
try
designer.AllowDataSettingsChange := true;
designer.DataSettings.AllowEditSQL := true;
designer.DataSettings.CollationType := ctANSI;
designer.DataSettings.DatabaseName := 'dbConnection';
designer.DataSettings.DatabaseType := dtOracle;
designer.DataSettings.SessionType := 'ADOSession';
designer.DataSettings.SQLType := sqSQL1;
designer.DataSettings.UseDataDictionary := false;
designer.AllowSaveToFile := false;
designer.Report := TppReport.Create(nil);
designer.ShowModal;
finally
designer.Free;
end;
end;
Thanks in advance,
Ed Vander Hoek
This discussion has been closed.
Comments
is this example along with a couple of dynamic report creation tips. You'll
have to create and ADO query datqaview. Look in daADO.pas for the class
name fo the objects in the ADO dataview. The example uses the BDE I
believe. If you have a dataview object after a template is loaded, then you
don't need to create one. You can still add objects to the dataview such as
search, order bys.. by extracting the TdaSQL object.
http://www.digital-metaphors.com/tips/DynamicReportCreation.zip
http://www.digital-metaphors.com/tips/DynamicSubReportCreation.zip
http://www.digital-metaphors.com/tips/CreateDataModViaCode.zip
http://www.digital-metaphors.com/tips/ExtractSQLObject.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
can learn.
Ed Vander Hoek