I have an interactive report displaying all the records from articles table. For a logged in author, I would like to display all the records, but the EDIT should be displayed only for those articles written by that author. In articles table, I have the column CREATED_BY
which has the author username.
I added a condition to Link Column as Value of Item / Column in Expression 1 = Expression 2 as Expression1=#CREATED_BY#
& Expression2= :APP_USER
But this does not work. This is the first time I am taking this approach to display edit link based on a condition.
When I added the condition Value of Item / Column in Expression 1 is not null
and set Expression1 = #CREATED_BY#
, it was still not displaying edit link. So, I think that #CREATED_BY#
is returning null. But the record in table has a value & I also see it in report column.
Can someone help? I don't know where I am going wrong.
The condition you use is for the column and not for each row so you will not be able to do it that way.
I think that the best way to achieve this is create a dummy column in your query that you will use as your edit link:
SELECT
CASE
WHEN CREATED_BY = :APP_USER THEN
'<a href="' || APEX_UTIL.PREPARE_URL( p_url => 'f?p=' || &APP_ID. || ':<YOUR EDIT PAGE>:'||&SESSION.||'::NO::<PAGE ITEM>:'||COLUMN ID, p_checksum_type => 'SESSION') || '"><img src="/i/menu/pencil2_16x16.gif"></a>'
ELSE ''
END edit_link,
...THE REST OF YOUR QUERY...
You also have to change the display of the column under column definition to
Standard Report Column
and optionally you can remove the options under
Allow Users To: so the user couldn't hide/sort/... the column.
Hope this can help you. Any doubt or further explanation just ask.