Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Trouble with using javascript $s function to populate a page item

882638Aug 16 2011 — edited Aug 16 2011
Hello Oracle APEX Community,

I'm working on a drilldown dashboard page and have been encountering a problem when i try to populate a Text Page Item (hidden or not) using the javascript built in $s function.
The function works great when the data is a number such as dept_id (even if the field type is varchar). However, trying to pass anything which is a text the process fails, except when a value is hard-coded as a parameter for the function. So for example, I have a chart with counts of constituents by state. I would like to populate (filter) a table based on when you click on a bar for a state without having to submit the page. I'm using dynamic actions and a built in javascript function in the SQL for the chart to accomplish this; but again, it works great when I use a varchar field like the FIPS code (i.e. the FIPS for Texas is '48'), but when I try to populate the page item using the state abbreviation 'TX' (again varchar) it fails.

Here's an example of code that works:
SELECT 'javascript:$s("P1_DEPTNO",'||d.deptno||')' LINK,
d.dname LABEL,
sum(e.SAL) sal
FROM emp e, dept d
where e.deptno = d.deptno
group by 'javascript:$s("P1_DEPTNO",'||d.deptno||')', d.dname 
And here's an example of code that does not work:
SELECT 'javascript:$s("P1_DEPTNO",'||d.loc||')' LINK,
d.dname LABEL,
sum(e.SAL) sal
FROM emp e, dept d
where e.deptno = d.deptno
group by 'javascript:$s("P1_DEPTNO",'||d.loc||')', d.dname 
However, when I hard code a text value the script works:
SELECT 'javascript:$s("P1_DEPTNO","BOSTON")' LINK,
d.dname LABEL,
sum(e.SAL) sal
FROM emp e, dept d
where e.deptno = d.deptno
group by 'javascript:$s("P1_DEPTNO","BOSTON")', d.dname
ORDER BY d.dname 
I'm encountering this problem on several versions of APEX: (4.0.2.00.07-local installation) and (4.1.0.00.28-apex.oracle.com)

Does anybody know of this problem and how to solve it? I've looked for settings on the page item itself, and can't figure it out.
I've re-written my sql to utilize the value fields of my tables instead but I have some objects on the page which are really going to depend on the character based data instead.

Thanks,
Wayne
This post has been answered by 560577 on Aug 16 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2011
Added on Aug 16 2011
2 comments
840 views