0
votes

I have an Interactive Grid, and I would like the grid to show the latest date records on top. However, Interactive Grid doesn't support Order by in the SQL.

Is there any way I can have these sorts applied by default, instead of user need to sort these reports by himself?

Also, I don't want to use Save Report as a developer as there are more than 400 reports in our application. Is there a programmable way to implement this?

3

3 Answers

2
votes

Manually, you can:

  • Open the Oracle APEX Builder and make sure you are logged in as developer
  • Run the Page with the Interactive Grid in the browser and log in with the same credentials
  • Apply an order by on one (or more) of the columns
  • Click 'Actions' -> 'Report'-> 'Save'
  • You should see the confirmation "Default report saved for all users"

Programmatically, you can't:

In APEX 20.1 there is a PL/SQL API available, APEX_IG. But currently it doesn't contain functionality what you're looking for..

New functionality will probably be added in future versions of APEX, but that's a guess and surely not something you can use right now.

1
votes

You can use WITH clause to "hide" ORDER BY clause from IG.

Let's say your select is:

select emp_id, name, date from employees

and you want to use order by clause in interactive grid's SQL, you just copy it into this:

 WITH my_sel AS 
  (SELECT emp_id, name, date 
     FROM employees
   ORDER BY date DESC)

SELECT emp_id, name, date
  FROM my_sel;

You can find more examples here.

0
votes

To sort by column:

01. Click the Actions menu, select Data, then Sort. The Sort dialog appears.

02. In the Sort dialog: Select a column, the sort direction (Ascending or Descending), and the null sorting behavior (Default, Nulls Always Last, or Nulls Always First).
    a. Column - Select a column.
    b. Direction - Select Descending or Ascending.
    c. Nulls - Select First or Last.
03. To add another sort rule, click the Add button (+).
04. Click Save.

05. Click Report
06. Click Save

The interactive grid reloads.

Note: To ensure that you are login developer mode, otherwise it is not show other user