Saving of Subreports
I wish to save some extra data with a sub report, would it be possible to
force subreports to be saved as full report definitions which can be dragged
back into the parent report or used standalone. What would happen about the
subreport datalinks if such a thing were possible.
--
Regards
Conrad Rowlands
Callards Technology Ltd
force subreports to be saved as full report definitions which can be dragged
back into the parent report or used standalone. What would happen about the
subreport datalinks if such a thing were possible.
--
Regards
Conrad Rowlands
Callards Technology Ltd
This discussion has been closed.
Comments
Subreport.Report.Template to do this at runtime. They are report templates,
the same as if you saved a template from a TppReport.Template. You can
thenload the template into a TppReport.
The dataviews are saved in the main datamodule of the TppReport. This isn't
very well known, but you can save the datamodule to a dtm file. This is a
datamodule template, similar to a report template, except instead of saving
the layout, it saves the data definition. What I would do is create dtm file
for each subreport individually, then merge them at runtime when the
subreports are loaded into the main report. This way you can still locate
the dataview (just have one in a dtm) for a subreport outside of a report so
you can move it around to other reports. The linking will need to be
performed at runtime when the dataviews are merged. I believe that if you
use AutoJoin and the datadictionary, it should auto link the dataviews
during a merge.
The subreports aren't draggable.This would be cool, but it would take some
magic to do this on a TForm in Delphi, as we would have to rip the TppReport
from the form, create a TppSubreport, and stream the TppReport to the child
report (TppSubreport.Report), then free the TppReport. It may work, but
doing this at Delphi design time may prove to be unstable. Generally, you'll
want to design your end user reports at runtime if you can, and not do it at
Delphi design time.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
OK Then, I have a few questions about this (sorry it has taken so long to
get around to this, you will probably need to re-read the posts).
1. How do I actually save the data modules to file?
2. Can I perform this operation on a subreport and thus save only the data
modules relating to and descending from this subreport, I am guessing not
though I am hoping so. The reason that this is applicable to me is that some
of the subreports, I consider to be reports in their own right whereas
others are just purely a tool to get disparate data into a report and don't
make any sense out of context.
3. How do I merge the data module into a report from the DTM file?
I also have another Kind of related problem which is this:-
As you maybe aware I am using the data, RAP, Design and Print Tabs all in
the one designer. If I set a report up (at runtime) with field links between
two pipelines upon coming into the screen everything is OK. I get my Master
Detail realtionships depicted correctly. However upon editing settings in
the RAP tab, or Data tab (changing the query constraints using the SQL
window) my Master Detail relationship is now lost. Is this a bug or am I
missing something. I can understand why it might happen with regards to the
data tab but not the RAP tab.
Any help of all of these matters would be greatly appreciated...
p.s. I havn't been onto the newsgroups for a while and very nearly had a
heart attack when your domain was down for three days!
--
Regards
Conrad Rowlands
Callards Technology Ltd
save a datamodule is to do it visually from the Data tab's menu. You can't
save the datamodule for a subreport, since the subreport simply uses the
dataviews defined in the master report's datamodule. Create a new report and
create a subreport's dataview and then save that datamodule to file or
database. Use the File | Export menu option. Continue to do this until you
have the different datamodules for each of your subreports. Then you can
merge the subreport datamodules to the main report datamodule at runtime- In
the designer, use the File | Merge option in the Data tab.
What do you mean edit the settings in the RAP tab? Are you editng the SQL?
Editing the SQL by hand will break the SQL generation logic and the master
detail links. If you aren't editing the SQL from a RAP pass through
function, then what are the steps to take to reproduce the problem using one
of our demo reports?
You can perform manual linking of dataviews in code if you would like. Here
are two examples you may find helpful depending on which approach you want
to take, either SQL edited dataviews or not.
http://www.digital-metaphors.com/tips/LinkEditSQLDataviews.zip
http://www.digital-metaphors.com/tips/LinkDataviewsInCode.zip
Here's a demo of loading a datamodule in code. In code, you can save a
datamodule to file by calling
http://www.digital-metaphors.com/tips/ReplaceDataModule.zip
{save a dataview}
lDataModule.Template.FileName := ExtractFilePath(ParamStr(0)) +
'Customer.dtm';
lDataModule.Template.SaveToFile;
Sorry about the newsgroups being down for three days. We were in the process
of moving our office from Texas to Colorado:)
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Unfortunately I cannot save a data module using the data tabs menu as this
application is to be seamless to the user. Therefore we will do all of the
saving programatically. No worries anyway because I can as you say stream
the data out to a dtm file which I can then save as binary in the database.
However you talk about the merge option in the data tab, I cannot see a way
to achieve this in the object model, I have no trouble in bringing in
(replacing the current data definition) a data definition for one report,
what I cannot figure out is how to merge three of four data definitions
programmtically into one parent report,
i.e. I have five report definitions:-
Def1 = Contact Report
Def2 = Event Report
Def3 =Mailing Report
Def4 = Choclate Fudge Banana Cake Report
Def5 = Main Shell Report
Defs1 - 4 can be inserted into Def5 to create a compound report or can be
run individually as reports in their own right.
In order to make defs 1- 4 function properly the data modules must reside
primarily in those definitions. When running the main shell report however I
will wish to import the appropriate def files and then import each files
datamodules so that all of the datamodules appear for each report that is
selected.
As to the problem that I was experiencing with the master detail links, I
have identified the problem as being due to the name of the 'datatable'
clearing out. I am not too bothered about this now, so long as I know how to
address the problem for the development staff who will utilise this tool.
Our users (bless 'em) will never experience those features as I intend to
prevent access to these areas . This does however force a question, I read
somewhere that if the Datatab is not visible the data definition will not be
streamed out.
1. Is this correct?
2. If so is there a way around this, will I still be able to
programmatically stream the data modules out?
3. Does this go for the RAP code too?
Thanks for your help...
Regards
Conrad Rowlands
Callards Technology Ltd
TdaDataModule.
procedure Merge(aDataModule: TdaDataModule);
procedure MergeWithReport(aReport: TppCustomReport);
No, the visual stuff can be left out and the internal classes can still be
linked in to use DADE and RAP behind the scenes. Remove raIDE and daIDE from
the uses clause. However, you still need to use DADE classes so the dataview
can be streamed up, so be sure to include the DADE plugin, something like
daDBBDE or daADO...See the tech tips newsgroup on controlling the end user
environment for a listing of DADE plugins. To use RAP behind the scenes like
DADE, add raCodMod to the uses clause.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com