如何 select 一个复选框并自动 select 其他相关复选框。?
How to select a checkbox and auto select other related checkbox.?
我有以下代码。我的目标是 select 一个复选框,然后所有其他相关的复选框也会被 select 编辑。当我 select 第一个复选框和下一组复选框时,我可以自动 select 其他复选框,但是当我 select 第二个复选框和第一个复选框与第二个,第一个复选框未 select 自动编辑,
看起来循环不会来回。我的代码哪里出了问题?
DECLARE
v_selected_contract VARCHAR2 (50);
v_selected_contract_ver NUMBER;
v_selected_contract_n VARCHAR2 (50);
v_selected_contract_ver_n NUMBER;
BEGIN
Go_block('PCMS_CONTRACT_LINES');
-- first_record;
IF :PCMS_CONTRACT_LINES.selected = 'Y' THEN
v_selected_contract := :PCMS_CONTRACT_LINES.contract_num;
v_selected_contract_ver := :PCMS_CONTRACT_LINES.contract_version_num;
WHILE :PCMS_CONTRACT_LINES.contract_num = v_selected_contract
AND :PCMS_CONTRACT_LINES.contract_version_num =
v_selected_contract_ver
LOOP
:PCMS_CONTRACT_LINES.selected := 'Y';
EXIT WHEN :System.last_record = 'TRUE';
next_record;
END LOOP;
Go_block('PCMS_CONTRACT_LINES');
first_record;
ELSE
v_selected_contract_n := :PCMS_CONTRACT_LINES.contract_num;
v_selected_contract_ver_n := :PCMS_CONTRACT_LINES.contract_version_num;
WHILE :PCMS_CONTRACT_LINES.contract_num = v_selected_contract_n
AND :PCMS_CONTRACT_LINES.contract_version_num =
v_selected_contract_ver_n LOOP
:PCMS_CONTRACT_LINES.selected := 'N';
EXIT WHEN :System.last_record = 'TRUE';
next_record;
END LOOP;
Go_block('PCMS_CONTRACT_LINES');
first_record;
END IF;
END;
Go_block('PCMS_CONTRACT_LINES');
first_record;
应该在你开始循环之前就在那里,否则如果你点击第二条记录,第二条之后的记录将被 selected,循环退出,控制转到第一条记录,但你不 select 它。
应该是这样的:
DECLARE
v_selected_contract VARCHAR2 (50);
v_selected_contract_ver NUMBER;
v_selected_contract_n VARCHAR2 (50);
v_selected_contract_ver_n NUMBER;
BEGIN
IF :PCMS_CONTRACT_LINES.selected = 'Y' THEN -- first current record is checked
Go_block('PCMS_CONTRACT_LINES'); -- go to the block
first_record; -- first record, then loop and select all.
v_selected_contract := :PCMS_CONTRACT_LINES.contract_num;
v_selected_contract_ver := :PCMS_CONTRACT_LINES.contract_version_num;
WHILE :PCMS_CONTRACT_LINES.contract_num = v_selected_contract
AND :PCMS_CONTRACT_LINES.contract_version_num =
v_selected_contract_ver
LOOP
:PCMS_CONTRACT_LINES.selected := 'Y';
EXIT WHEN :System.last_record = 'TRUE';
next_record;
END LOOP;
Go_block('PCMS_CONTRACT_LINES');
first_record;
ELSE
Go_block('PCMS_CONTRACT_LINES'); -- go to the block
first_record; -- first record, then loop and unselect all.
v_selected_contract_n := :PCMS_CONTRACT_LINES.contract_num;
v_selected_contract_ver_n := :PCMS_CONTRACT_LINES.contract_version_num;
WHILE :PCMS_CONTRACT_LINES.contract_num = v_selected_contract_n
AND :PCMS_CONTRACT_LINES.contract_version_num =
v_selected_contract_ver_n LOOP
:PCMS_CONTRACT_LINES.selected := 'N';
EXIT WHEN :System.last_record = 'TRUE';
next_record;
END LOOP;
Go_block('PCMS_CONTRACT_LINES');
first_record;
END IF;
END;
我有以下代码。我的目标是 select 一个复选框,然后所有其他相关的复选框也会被 select 编辑。当我 select 第一个复选框和下一组复选框时,我可以自动 select 其他复选框,但是当我 select 第二个复选框和第一个复选框与第二个,第一个复选框未 select 自动编辑,
看起来循环不会来回。我的代码哪里出了问题?
DECLARE
v_selected_contract VARCHAR2 (50);
v_selected_contract_ver NUMBER;
v_selected_contract_n VARCHAR2 (50);
v_selected_contract_ver_n NUMBER;
BEGIN
Go_block('PCMS_CONTRACT_LINES');
-- first_record;
IF :PCMS_CONTRACT_LINES.selected = 'Y' THEN
v_selected_contract := :PCMS_CONTRACT_LINES.contract_num;
v_selected_contract_ver := :PCMS_CONTRACT_LINES.contract_version_num;
WHILE :PCMS_CONTRACT_LINES.contract_num = v_selected_contract
AND :PCMS_CONTRACT_LINES.contract_version_num =
v_selected_contract_ver
LOOP
:PCMS_CONTRACT_LINES.selected := 'Y';
EXIT WHEN :System.last_record = 'TRUE';
next_record;
END LOOP;
Go_block('PCMS_CONTRACT_LINES');
first_record;
ELSE
v_selected_contract_n := :PCMS_CONTRACT_LINES.contract_num;
v_selected_contract_ver_n := :PCMS_CONTRACT_LINES.contract_version_num;
WHILE :PCMS_CONTRACT_LINES.contract_num = v_selected_contract_n
AND :PCMS_CONTRACT_LINES.contract_version_num =
v_selected_contract_ver_n LOOP
:PCMS_CONTRACT_LINES.selected := 'N';
EXIT WHEN :System.last_record = 'TRUE';
next_record;
END LOOP;
Go_block('PCMS_CONTRACT_LINES');
first_record;
END IF;
END;
Go_block('PCMS_CONTRACT_LINES');
first_record;
应该在你开始循环之前就在那里,否则如果你点击第二条记录,第二条之后的记录将被 selected,循环退出,控制转到第一条记录,但你不 select 它。
应该是这样的:
DECLARE
v_selected_contract VARCHAR2 (50);
v_selected_contract_ver NUMBER;
v_selected_contract_n VARCHAR2 (50);
v_selected_contract_ver_n NUMBER;
BEGIN
IF :PCMS_CONTRACT_LINES.selected = 'Y' THEN -- first current record is checked
Go_block('PCMS_CONTRACT_LINES'); -- go to the block
first_record; -- first record, then loop and select all.
v_selected_contract := :PCMS_CONTRACT_LINES.contract_num;
v_selected_contract_ver := :PCMS_CONTRACT_LINES.contract_version_num;
WHILE :PCMS_CONTRACT_LINES.contract_num = v_selected_contract
AND :PCMS_CONTRACT_LINES.contract_version_num =
v_selected_contract_ver
LOOP
:PCMS_CONTRACT_LINES.selected := 'Y';
EXIT WHEN :System.last_record = 'TRUE';
next_record;
END LOOP;
Go_block('PCMS_CONTRACT_LINES');
first_record;
ELSE
Go_block('PCMS_CONTRACT_LINES'); -- go to the block
first_record; -- first record, then loop and unselect all.
v_selected_contract_n := :PCMS_CONTRACT_LINES.contract_num;
v_selected_contract_ver_n := :PCMS_CONTRACT_LINES.contract_version_num;
WHILE :PCMS_CONTRACT_LINES.contract_num = v_selected_contract_n
AND :PCMS_CONTRACT_LINES.contract_version_num =
v_selected_contract_ver_n LOOP
:PCMS_CONTRACT_LINES.selected := 'N';
EXIT WHEN :System.last_record = 'TRUE';
next_record;
END LOOP;
Go_block('PCMS_CONTRACT_LINES');
first_record;
END IF;
END;