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

How do I group on a data field when data not connected ?

edited April 2004 in General
I am working on a large program when the data set is never connected/live at
design time because you don't know which set of data will be used and the
queries are often made in code at runtime.

It seems the design interface for report builder is very angled towards
having live data available.

I am trying to add a new group and the "Data Field" option is disabled.
Does anyone know how I can add a group on a data field by just typing in the
field name ?

--
Andrew Cutforth
AJC Directory Synchronizer: Directory Compare & Synchronize
www.ajcsoft.com

Comments

  • edited April 2004
    Hi Andrew,

    Unfortunately if you would like to create a group at design time for a field
    in your dataset, the dataset will need to be connected to the current
    database and active. Otherwise there is no way for ReportBuilder to know
    the field names or locations. If you know the exact name of the field you
    wish to group on, you could create a group in code without the use of the
    designer at design time. For help on createing groups in code, please see
    the article below.

    ----------------------------------------------------
    Tech Tip: Creating a Group in Code
    ----------------------------------------------------


    How can I dynamically create a report group at run-time?


    example code:
    -------------

    uses
    ppClass, ppGroup, ppClasUt;


    function AddGroupToReport(aBreakName: String; aDataPipeline:
    TppDataPipeline; aReport: TppCustomReport);
    var
    lGroup: TppGroup;
    lGroupBand: TppGroupBand;

    begin


    {add group to report}
    lGroup := TppGroup(ppComponentCreate(aReport, TppGroup));

    lGroup.Report := aReport;

    lGroup.BreakName := aBreakName;
    lGroup.DataPipeline := aDataPipeline;

    {add group header and footer bands }
    lGroupBand := TppGroupBand(ppComponentCreate(aReport,
    TppGroupHeaderBand));
    lGroupBand.Group := lGroup;

    lGroupBand := TppGroupBand(ppComponentCreate(aReport,
    TppGroupFooterBand));
    lGroupBand.Group := lGroup;


    end; {procedure, AddGroupToReport}


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2004
    You can add a TDBText field and type in the field name. Would it not be
    easy to alter the group facility so you could also type in the field name ?

    The work around we are using now is to group on the TDBText field.
    Obviously if we want to group on something we do not want to print we will
    have to make it invisible.

    I must admit I am surprised that there are not many other users who do not
    have data available at design time. With large complex software I would
    assume this is often the case.

    I have a problem with a group though (see later post).

    --
    Andrew Cutforth
    AJC Directory Synchronizer: Directory Compare & Synchronize
    www.ajcsoft.com
  • edited April 2004
    Hi Andrew,

    Thanks for the feedback. I will mark this down as a possible enhancement
    for the next release.

    --
    Best Regards,

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