multi record blocks [message #134068] |
Tue, 23 August 2005 08:10 |
dmack
Messages: 42 Registered: March 2005 Location: TNT
|
Member |
|
|
Hi everyone,
I have a nulti-record block that displays records retrieved from a query (these are program names). There is another multi_record block that displays other records (locations to which the programs in the previous block are to be deployed).
This is how the form works:
1. query program names
2. select program/s to be deployed using check boxes
3. then select using the check boxes the desired location in the other block.
after which the program name and location are inserted into a table within a script. This works fine when i select only one program to be deployed to any number of locations. however the problem occurs when i select more than one program to be deployed. Only the first program in the multirecord gets inserted into the table. I am aware that I would have to craete a loop but am not too certain how. thsi is the existing code.
declare
script_cnt number(4) := 0;
begin
if :serv_location.destinationcheck = 'Y' THEN
select count(dep_script)
into script_cnt
from temp_deploy
WHERE dep_script = 'copy \\systools\data\signedoff\'|| :prog_name ||' \\'||:serv_location.location_ip||'\IA20006i';
If script_cnt = 0 then
insert into temp_deploy(dep_script)
values ('copy \\systools\data\signedoff\'|| :prog_name ||' \\'||:serv_location.location_ip||'\IA20006i');
commit;
END IF;
END IF;
END;
Please help
|
|
|
Re: multi record blocks [message #134211 is a reply to message #134068] |
Tue, 23 August 2005 20:02 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
As this is not a master detail relationship but a joining between two multirow tables, my first question is do you want all the selected programs to go to all the selected locations?
Create a button labelled 'Save'(?), in it do the followingbegin
go_block ('prgms');
first_record;
LOOP
if :prgms.chk_box = 'Y' then
go_block ('locs');
first_record;
LOOP
if :locs.chk_box = 'Y' then
insert_your_record;
end if;
EXIT WHEN :system.last_record = 'TRUE';
next_record;
END LOOP;
end if;
go_block ('prgms');
EXIT WHEN :system.last_record = 'TRUE';
next_record;
END LOOP;
end; I haven't tested this code, and you will probably need to add labels to the loops.
It also will leave the cursor at the last record of each block so you may want to save your start position.
David
Upd: I missed one go_block.
[Updated on: Tue, 23 August 2005 20:04] Report message to a moderator
|
|
|