I have an IG with the query:
select null as link, emp_id,emp_name from employees;
Here the link column has html attributes.
Now I need to add the server-side condition as I only want the link
column to display if emp_id >1000;
If not display atleast disable it if emp_id <1000
How can this be added?
This cannot be done in the column definition with a server-side condition. A server-side condition will hide the column for the entire report, not just for the current row. How would that be rendered anyway ? What you are looking for is a mechanism to show/hide a button based on the data. For example, for the the example I documented in the last question you could do this by making the following change. It uses APEX Template Directives. The functionality is that the button is shown for all emp records except for KING.
modify the query
There needs to be a column that has a value indicating a row button is shown/hidden. The values you want are “none” for hidden and “block” for shown.
select EMPNO,
ENAME,
JOB,
MGR,
HIREDATE,
SAL,
COMM,
DEPTNO,
CASE WHEN ENAME = 'KING' THEN 'N' ELSE 'Y' END as SHOW_BUTTON
from EMP
Set the column SHOW_BUTTON as type “Hidden”.
modify the button markup
The “if directive” evaluates the value of the SHOW_BUTTON column and conditionally renders the button markup:
{if SHOW_BUTTON/}
<button type="button" data-empno="&EMPNO!ATTR."
class="increase-salary-Button t-Button t-Button--icon t-Button--warning t-Button--iconLeft"><span aria-hidden="true" class="t-Icon t-Icon--left fa fa-arrow-circle-up"></span>My Button</button>
{endif/}
1