Improve Order By on Windows

Description

There are lots of tabs that don’t have an Order By defined.

This can be discovered with the following query:

SELECT t.ad_tab_id, w.name, t.name, t.seqno, tb.tablename, COALESCE(orderbyclause, '-> '||(SELECT string_agg(c.columnname||CASE WHEN f.SortNo<0 THEN ' DESC' ELSE '' END,', ' ORDER BY ABS(f.sortno)) FROM ad_field f JOIN ad_column c ON (c.ad_column_id=f.ad_column_id) WHERE ad_tab_id=t.ad_tab_id AND f.sortno IN (-3,-2,-1,1,2,3))) AS orderbyclause FROM ad_tab t JOIN ad_window w ON (w.ad_window_id=t.ad_window_id) JOIN ad_table tb ON t.ad_table_id=tb.ad_table_id WHERE t.isactive='Y' AND w.isactive='Y' AND tb.isactive='Y' AND t.issorttab='N' ORDER BY w.name, t.seqno

Environment

None

Activity

Show:
Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created October 27, 2024 at 4:39 PM
Updated December 2, 2024 at 2:30 PM
Resolved October 30, 2024 at 12:27 PM