Oracle Apex - Dynamically check checkbox item that is not within a report

ぐ巨炮叔叔 提交于 2019-12-07 07:20:27

Not sure it is exaclty what you want but if you simply need to initialize a checkbox item on page load, you can :

1 - Use the Source attribute of the checkbox item and set the following attributes :

  • Source Used : Always, replacing any existing value in session state
  • Source Type : SQL Query (return single value) or SQL Query (return colon separated value) depending if your checkbox item contains several checkboxes or not.
  • Source value or expression : your query that returns the right values.

2 - Use a Before header computation to compute your item :

  • Compute Item : Your checkbox item
  • Computation Point : Before header
  • Computation Type : SQL Query (return single value) or SQL Query (return colon separated value) depending if your checkbox item contains several checkboxes or not.
  • Computation : your query that returns the right values.

Note: I use checkboxes in reports too, but I noticed that when you have a lot of rows, it is very slower than using simple HTML checkboxes, so if you think your report is slow, I suggest you to generate simple HTML checkboxes from your query :

SELECT
  at.name AS TITLE,
  CASE WHEN at.name IN (SELECT atp.name FROM preferences p) THEN
    '<input type="checkbox" value="'||at.value||'" checked="checked" />'
  ELSE
    '<input type="checkbox" value="'||at.value||'" />'
  END AS CHECKBOX
FROM
  [...]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!