Monday, August 15, 2016

Apex report: Conditionally showing the link url

Apex report: Conditionally showing the link url

Sometime in the report/form combination, we will need to show/hide the linked url based on value of another col of the report, for example, in following report:

select empno,ename,job from emp;

There is a link on the empno col, (the link will point to the EMP detail form). What I would like to do is to only enable the link if the person's job title is 'Manager', otherwise hide the link.

Here is how to do it:

1. Modify the report sql to:
     select empno,ename,job,decode(job,'Manager','Y','N') flag from emp;
2.  in the report page(inline css section), put this in:
     .N { display: none; }
3. in the linked attribute of the report linked col, put this in
    class="#flag#"

That't IT!

In case you are not happen with the default edit icon, you can replace with a dynamic action on the report page:

create a dynamic action(after refresh), run javascripts:

$(".Y").removeClass("Y").addClass("fa fa-user-plus fa-2x")

In this case, I am replacing the default edit link icon with an font awesome icon

No comments:

Post a Comment