英文:
APEX - select list - how to have selection set multiple page items
问题
我有一个由值列表SQL查询填充的 APEX "选择列表"。我正在尝试弄清楚如何使选择列表的选择结果导致设置多个页面项目。
我有一个单选选择列表,通过简单的SQL查询设置了一个值列表。
示例:
页面项目名称:P1_ITEM_ID
类型:选择列表
选择后的页面操作:重定向并设置值
值列表:
- 类型:SQL查询
- 查询:
select item_desc, item_id
from item_table
order by 1;
通过这种配置,选择会将 P1_ITEM_ID 设置为 item_table 的 "item_id" 值。但是,假设 "item_table" 还有其他列,比如 "item_type" 和 "item_price",我希望在选择列表选择后将它们作为文本字段(P1_ITEM_TYPE、P1_ITEM_PRICE)在会话状态中访问。有什么建议我可以怎么做?
英文:
I have an APEX "select list" which is populated by a list of values SQL query. I'm trying to figure out how to have the select list selection result in more than one page item being set.
I have a single selection select list with a list of values set via a simple sql query.
ex:
page item name: P1_ITEM_ID
type: select list
page action on selection: Redirect and Set Value
list of values:
- type: SQL query
- query:
select item_desc, item_id
from item_table
order by 1;
With this configuration, a selection sets P1_ITEM_ID to the item_table's "item_id" value. However, assume "item_table" has additional columns, say "item_type" and "item_price", which I'd like to be accessible in session state as text fields (P1_ITEM_TYPE, P1_ITEM_PRICE) upon the select list selection. Any suggestions as to how I could do that?
答案1
得分: 0
通过使用动态操作,可以实现这一目标。您可以创建一个在选择列表的更改事件上触发的动态操作。动态操作的真实操作可以设置为执行PL/SQL代码或JavaScript代码,根据选择的选择列表的值设置其他页面项目的值。
例如,您可以创建一个动态操作,具有以下属性:
- 事件:更改
- 选择类型:项目
- 项目:P1_ITEM_ID
- 操作:执行PL/SQL代码或执行JavaScript代码
在PL/SQL或JavaScript代码中,您可以使用P1_ITEM_ID的选定值来查询您的item_table以获取相应的item_type和item_price值,然后相应地设置P1_ITEM_TYPE和P1_ITEM_PRICE的值。
英文:
One way to achieve this is by using a dynamic action. You can create a dynamic action that fires on the change event of your select list. The true action of the dynamic action can be set to execute PL/SQL code or JavaScript code that sets the values of the other page items based on the selected value of the select list.
For example, you could create a dynamic action with the following properties:
- Event: Change
- Selection Type: Item
- Item(s): P1_ITEM_ID
- Action: Execute PL/SQL Code or Execute JavaScript Code
In the PL/SQL or JavaScript code, you can use the selected value of P1_ITEM_ID to query your item_table for the corresponding item_type and item_price values, and then set the values of P1_ITEM_TYPE and P1_ITEM_PRICE accordingly.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论