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

Sort Order

edited June 2003 in General
Hi,

I am aware of the ability to choose criteria using functions such as these:

ppReport1.FreeAutoSearchFields;
ppReport1.CreateAutoSearchCriteria;

but is there an easy way to select the sort order of a report based on a
user's choice (via my own custom prompt)?

Regards


Alex

Comments

  • edited June 2003
    Alex,

    Sorry, but there is no auto-sort capability in ReportBuilder.

    You could try changing the dataset before printing the report by adding an
    OrderBy in the SQL based on what a user enters. The key is that when you
    are reordering, that you might have to change the grouping of the report.

    --
    Best Regards,

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

    How and where would I do that? I am using 6.03

    --
    Alex

  • edited June 2003
    Hi Alex,

    You will need to change the dataset anytime before you call Report.Print.
    You can do this by directly accessing the dataset in the Delphi form. If
    you are using Autosearch, you could possibly use those events to change the
    dataset as you need.

    --
    Best Regards,

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

    I don't think changing the dataset is a solution for me. The report feeds
    into the end-user facility, so I would need a way to modify the final SQL
    statement created by ReportBuilder (I guess?) and also the report groups if
    necessary. At what stage can I gain access to the SQL statement, and what
    would be the best way to modify the SQL statement? Are there any examples
    of doing this?

    Regards

    --
    Alex

  • edited June 2003
    Alex,

    You will need to use the OnLoadEndEvent to access the SQL statement. Below
    is a link to an example that shows how this can be done.

    http://www.digital-metaphors.com/tips/ReverseOrderBys.zip

    --
    Best Regards,

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

    Thanks for the example, thats a good start for me in relation to changing
    SQL on the fly. When editing a report at the end-user level, you can create
    from the Report/Groups menu, a group header and footer band. How can I
    access (modify) the settings in these?

    For example, if a user can select FldA or FldB, I would like to be able to
    group by the selected field, and also specify whether to start a new page or
    not at the start of a new group.

    Thanks
    --
    Alex

  • edited June 2003
    Nico,

    Is OnLoadEndEvent a RB7 event, I cant find it in RB603. If so, any other ay
    to access the SQL statement.

    Regards

    --
    Alex

  • edited June 2003
    Alex,

    The OnLoadEndEvent is available in ReportBuilder 6.03. It is publicly
    assigned, not published so you will need to assign it programmatically See
    the code I sent you before for an example of this.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2003
    Alex,

    You can access a particular group object by using the Report.Groups array.
    Check out the article below on creating a group in code. You should also
    check out the RBuilder help under TppGroup for more information on how
    groups work with reports.

    ----------------------------------------------------
    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 June 2003
    Ok Nico,

    All this info is providing very useful, thanks. I cannot see any reference
    to an OnLoadEndEvent in the example code you sent me. Also is there any
    documentation which describes the properties etc of daSQL, daQueryDataView,
    daDataModule and so on?

    Regards

    --
    Alex

  • edited June 2003
    Alex,

    Sorry about that. You can see a good example of how the OnLoadEnd Event
    works in the myEURpt.pas file located in the \RBuilder\Demos\3. EndUser\1.
    Report Explorer\... directory.

    For help with the DADE classes, please refer to the Tech-tips newsgroup in
    the DADE section. You may also post any questions you have in the .dade
    newsgroup as we have a wealth of examples and information that could be very
    usefull.

    --
    Best Regards,

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