3
votes

I have an interactive report in Oracle Apex 4.1. I need to pass a column value to an apex item when i click a link button on that interactive report. I have searched on Google and found a solution :

onclick="$s('P4_PAGEITEM', #COLUMN_NAME#); return false;" 

But it seems it's only working for numbers. When I try passing a string value it always returns wrong number format.

Also, can I access an interactive report column value from JavaScript?

2

2 Answers

3
votes

#COLUMN_NAME# is a substitution string. It will literally put the value of the column for that row in the string.
When the value is a number, it will generate

onclick="$s('P4_PAGEITEM', 9875); return false;"  

Now, if the value would be a string

onclick="$s('P4_PAGEITEM', ALLEN); return false;"  

To deal with this, alter your link with adding quotes around #COLUMN_NAME#

onclick="$s('P4_PAGEITEM', '#COLUMN_NAME#'); return false;"  

Also, can I access an interactive report column value from JavaScript?

All HTML on the page you see is accessible from javascript/jQuery and only requires you to use the correct selector. You do need to understand HTML and the DOM though.
A good start is always using a browser with the correct tools which will allow you to inspect elements, html, dom, javascript, css,... An example is the Firebug plugin for Firefox.
Targeting values in a report requires you to know its markup which you can find by inspecting the generated page html. Keep in mind that page and region templates can make a difference depending on the theme you are using.

If you are stuck on this, post a new question about it and provide html and an explanation of what you are trying to get at. This question is an example of targetting values in a table: How to select a row element value from Oracle APEX 4 Classic Report (row element from a table tags)

1
votes

have you tried using quotes arround your column value ? :

onclick="$s('P4_PAGEITEM', '#COLUMN_NAME#'); return false;"

It works for me.