Notifications
Clear all

orderByClause

1 Posts
2 Users
0 Reactions
845 Views
0
Topic starter

${orderByClause}. Seen in many reports. Is it a report Macro provided by platform? How is it used or What is it used for?

1 Answer
0

${orderByClause} is defined in com.transcendsys.platform.server.report.CustomPagingAndSortingReportHandler.
This is subclass of standard report handler class (com.transcendsys.platform.server.report.BaseReportHandler).

The standard report handler applies paging and order by clause to sql defined in <SqlDef> of report.
e.g. if the report has following sql

select * from my_table

then its wrapped as

SELECT * FROM ( -- paging wrapper
 SELECT inner_table.*, ROWNUM rnum  FROM (
    SELECT * FROM (  -- order by wrapper
        select * from my_table  -- query from report
    ) ORDER BY <column names>
) inner_table WHERE ROWNUM <= $LAST_ROWNUM$) 
WHERE rnum > $FIRST_ROWNUM$

i.e. the report query is wrapped in order and paging caluses.

But if report author wants to override this default wrapping then com.transcendsys.platform.server.report.CustomPagingAndSortingReportHandler needs to be used and report author needs to put ${orderByClause} in sql where its needed.