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

Retrieving report band groupings in code

edited September 2007 in General
Hi,

I know you can retrieve report dataviews by loading the report:

FReportBuilder.ppReportExplorer1.LoadReport(reportName, ReportCommonCode);

and reading via the following:

daDataModule.DataViews[i]

Is there a way to similarly find and list the group bands that have been set
up in an end-user report? If not this way, how is the best way to find the
groups within Delphi code?

Thankyou

Alex

Comments

  • edited September 2007
    Hi Alex,

    You can use the Report.Groups[] property to access each group created in a
    report. Once you have access to the group you can access the HeaderBand and
    FooterBand properties. There are also the Report.GroupHeaderBand[] and
    Report.GroupFooterBand[] properties to access each group header and footer
    band directly from the report.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    Hi and thanks Nico thats worked a treat,

    I also need to grab all the defined fields in the dataview. Are you able to
    point me in the right direction. I presume we would be working with
    DataView in this case.

    Thanks

    Alex

  • edited September 2007
    Hi There,

    This question below might have been missed. Is it possible to obtain all
    the defined fields in a dataview?

    Thanks

    Alex
  • edited September 2007
    Hi Alex,

    Sorry, I did not see the next question.

    You can access the selected fields from the DataPipeline object. Either by
    using the Report.Datapipeline property or accessing the pipeline from the
    dataview itself. DataView.DataPipelines[].

    Use the Fields[] property of the datapipeline to access each individual
    field.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    Hi Nico,

    I'm still a little confused. From what I can tell from the documentation,
    the ppReport.DataPipeline refers to the main report assigned data module. I
    need to find the fields contained in any chosen data module - there can be
    more than one (as defined in Data tab of end-user capability). I presume
    then I need to use DataView, but the only information I can see on DataView
    relates to AutoSearchFields.

    Thanks

    Alex

  • edited September 2007
    Alex,

    I'm a bit unclear about how your report is setup.

    There is only ever one DataModule object for a report. The DataModule can
    contain numerous QueryDataView objects, which have access to the
    datapipeline(s) that essentially accesses the DB (fields, data, etc). You
    can gain access to the pipeline associated with each querydataview using the
    TDataView.DataPipelines[0] property.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    Hi Nico,

    Thanks, sorry my terminology was a bit wrong. Yes I am referring to the
    QueryDataView objects. My question then is how do I access TDataView. Is
    this a property of TppReport. It is not clear to me how to access this from
    a TppReport component.

    Thanks

    Alex

  • edited September 2007
    Hi Alex,

    You can use the daGetDataModule() routine to obtain the datamodule
    associated with a report object...

    uses
    daDatMod;


    lDataModule := daGetDataModule(Report);

    if (lDataModule <> nil) then
    lDataView := lDataModule.DataViews[0];


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.