On a certain page, I have an APEX Interactive Report. Part of the query is similar to:
(column1 definition) BCV,
(column2 definition) RFV,
FROM table_name table , ...
I also have a page item P121_SORT_BY (select box) defined through the following LOV:
SELECT 'BCV' d,'BCV' r FROM DUAL
SELECT 'RF Value' d,'RFV r' FROM DUAL
SELECT 'RA (USD)' d,'RAU' r FROM DUAL
var my_column= $v('P121_SORT_BY');
$x('apexir_COLUMN_NAME').value = my_column;
Obiously, there's something wrong with my JS code... what can I do to make my Interactive Report sort DESCENDING by the column selected in my page item?
Please note that I also tested the JS without the comments, and I get the pop-ups (test1, test2, test3 and the correct name of the column in my_column) but the report doesn't get sorted... what am I doing wrong?
Thanks, but that doesn't work, and it's the first thing I tried. It was then, when I placed the "ORDER BY 1" clause when I saw that the sorting doesn't work in an IR if you place it in the APEX query.
It works for other reports, but NOT interactive reports.
I found the answer to my question by navigating through the java scripts in Apex.
So this is what's working:
gReport.last_col_id = 'BCV';
Where 'BCV' is actually your column heading name, and you can send it through a Page Item, and 'DESC' means descending, and 'ASC' means ascending.
I hope this helps other people too.