oracle-databaseoracle-apexoracleapplications

Oracle Apex 4.2 interactive report with lookup tables


I have created a table Called NAMES inside that I have a column called Status.

On STATUS, I created a lookup table and this created a new table called Status_lookup Which has 2 column (STATUS_ID and Status)

So the NAMES table column changed to STATUS_ID

when I do interactive reports, the data do come through from STATUS_ID which is number, I need the text that is stored in the Status.

Could some please explain how I do this. This I thought would be pretty easy but I can't see how to do it. I am not Newbie to Oracle applications so a step by step would be helpful


Solution

  • Example: select * from emp
    I want DEPTNO to display the DNAME which can be found in DEPT
    What I usually do is:
    Go to "Shared Components > Lists of Values", and create a new one from scratch, type dynamic.

    I'm calling my LOV "DEPARTMENTS", and it has this SQL:

    select dname d, deptno r
    from   dept
    order by 1
    

    To then map this to the column in the IR, go to the page with the IR and edit it. Go to the report attributes. From there you can see the columns in the IR and edit their attributes by clicking the pencil icon. report attributes In the column attributes you can then change the display type of the column. Set it to "Display as Text (based on LOV, escape special characters)".
    Then go to the "List of Values" section, and select the LOV from the "Named List of Values" select list. (In my example this is "DEPARTMENTS").
    Apex will then map the values in the IR sql to that of the display value of the LOV. column attributes

    Alternatively, you could of course also just change the SQL of the report to map a display value, for example:

    SELECT empno, ename, depto, (select dname from dept where deptno  = e.deptno) dname
    from emp