如何在APEX ORACLE中创建和使用多选列表? [英] How to create and use a multi-select list in APEX ORACLE?

查看:342
本文介绍了如何在APEX ORACLE中创建和使用多选列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为Employees的表,其中包含Employee_id和Employee_Name列.现在,我想创建一个页面,在每个雇员姓名"的前面都带有复选框",选择所需的页面,将其存储到临时表中,并用于进一步的操作.我面临的问题是如何创建多选择列表并将选择值存储在表中.有多选项目吗?如果没有,我该怎么办?

I have a table called Employees with Employee_id and Employee_Name columns. Now i want to create a page with Checkbox in-front of every Employee Name, select the ones that are needed, store them into a temporary table and use them for further operations. The problem i am facing is to how to create that multi select list and store the select values in thee table. Is there an Item for multi select? If not, how should i do it?

推荐答案

班车项目.在左侧,您将显示所有员工的列表.使用项目按钮,您可以将所有(或仅其中一些)移动到项目的右侧.提交页面后,员工ID列表将以冒号分隔的值形式存储在表格列中,例如

There's the Shuttle item. On the left side, you'd display list of all employees. Item buttons allow you to move all (or only some of them) to the right side of the item. Once you submit the page, list of employee IDs is stored into a table column in a form of colon-separated values, for example

6547:8879:5587:9987

这是一种简单的方法.但是,一旦必须使用这些值实际执行 操作,就必须将它们拆分为行.不过没问题.这是一个查询:

This is a simple way of doing that. However, once you have to actually do something with those values, you have to split them to rows. Not a problem, though. Here's a query:

SQL> with emps (shuttle_item) as
  2    (select '6547:8879:5587:9987' from dual)
  3  select regexp_substr(shuttle_item, '[^:]+', 1, level) one_item
  4  from emps
  5  connect by level <= regexp_count(shuttle_item, ':') + 1;

ONE_ITEM
---------------------------------------------------------------------
6547
8879
5587
9987

SQL>

或者,您可以创建一个表格形式,该表格还显示所有员工,并且在每一行的开头都有复选​​框.然后,您将创建一个过程,该过程将循环将选定的值存储到您提到的临时表中.例如:

Or, you could create a tabular form which also displays all employees and has checkboxes at the beginning of every line. You'd then create a process which - in a loop - stores selected values into a temporary table you mentioned. For example:

-- F01 = row selector. If you check 1st and 3rd row, f01.count = 2 (2 rows checked)
--       f01(1) = 1 (row #1), f01(2) = 3 (row #3)
-- F02 = EMP_ID. f02(1) = EMP_ID that belongs to employee in 1st row, 
--       f02(3) = EMP_ID that belongs to emplyee in 3rd row
declare
  l_id number;
begin
  for j in 1 .. apex_application.g_f01.count
  loop
    l_id := apex_application.g_f02(apex_application.g_f01(j));

    insert into temp_table (emp_id) values (l_id);
  end loop;
end;

这篇关于如何在APEX ORACLE中创建和使用多选列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆