Sort Order
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
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
This discussion has been closed.
Comments
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.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
How and where would I do that? I am using 6.03
--
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.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
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
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
Is OnLoadEndEvent a RB7 event, I cant find it in RB603. If so, any other ay
to access the SQL statement.
Regards
--
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.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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}
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
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.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com