anand gp
anand gp

Reputation: 11

how to ignore state of a Non-database column in a APEX report

I have created a Master-Detail page. Detail region is a report region. Assume, master region records products manufactured and it's details.
Assume, detail region records list of employees involved (multiple rows) and their details.
For the sake of redundency EMPNO column is present in Detail Table, but not the EMP_NAME column. My question is, I would like to show a non-database column EMP_NAME in detail region. EMP_NAME holds value based on EMPNO column value (after querying EMP table). How to achieve this? Please help. (I use Apex 4.2.6)

Thanks, -Anand

Upvotes: 1

Views: 519

Answers (2)

Tony Andrews
Tony Andrews

Reputation: 132670

You could add a scalar subquery column to the query:

select ...,
       (select emp_name from emp where emp.empno = det.empno) as emp_name
  from details det
   ...

APEX will make this a Display As Text column by default.

But if you want this to display the new for a new record as well, that isn't enough. You could instead change the Display As attribute of the EMPNO column to Select List, and then define the LOV as

select ename, empno from emp order by ename

Now instead of typing in an EMPNO value and trying to get the name to appear in another column, the name will appear in the select list instead of the EMPNO. Or you could show the EMPNO as well like this:

select empno||' - '||ename as d, empno from emp order by 1

Upvotes: 0

Ftaveras
Ftaveras

Reputation: 719

You can subfix ignored column names with _NOSUBMIT. Your query will look like:

SELECT D.EMPNO
...
, EMP.EMP_NAME AS EMP_NAME_NOSUBMIT
, FROM ...

Apex will ignore nosubmit fields.

Upvotes: 0

Related Questions