Master-detail form / WHEN-NEW-ITEM-INSTANCE trigger problems [message #310964] |
Thu, 03 April 2008 00:00  |
spmano1983
Messages: 269 Registered: September 2007
|
Senior Member |
|
|
Friends,
I have master-detail form. master (dept) and detail (emp).
i have one custom table that is tab1(empno,hike);
That empno is same empno only, and hike is sal+1000 for every employee. These both are non database item in emp block.
Suppose if i query dept 10 in runtime. then all 10 department details records are coming perfectly with calculated salary (text item hike). If i save, then i want this details record should be store into my custom table tab1, that is this employee number with hike salary (sal+1000). But here 1st detail record only stored. Except 1st record not stored in table. How i can do? Any loop i should uuse? In which trigger i can do this?, pls give your suggestion on this.
Thanks
Mano
[MERGED by LF; please, do not open a new topic for an old problem. Continue discussion in existing one.]
[Updated on: Fri, 04 April 2008 06:22] by Moderator Report message to a moderator
|
|
|
|
|
|
when-new-item-instance problem [message #311379 is a reply to message #310964] |
Fri, 04 April 2008 05:29   |
spmano1983
Messages: 269 Registered: September 2007
|
Senior Member |
|
|
Friends,
I have three blocks dept,emp,block1.
dept and emp is master-detail relationship (deptno). if i query 10 deptno then its coming all the 10 department in second block.
in the thrid block i have one trigger when-new-item-instance, its having
begin
go_block('emp');
first_record;
loop
insert into mano_tab values(:emp.empno,:emp.sal+100,null);
go_block('emp');
exit when :system.last_record='TRUE';
message(:system.last_record);
next_record;
end loop;
exception
when others then
null;
end;
Every salary for employee (emp block) i have calculated with 1000 rs and store in mano_tab custom table. that is what i wrote this above codes. Its working fine. But i have to move the cursor to that corresponding text item. then only i will fire. I want, when i query 10 record, that same time my calculation should be calculated and stored also. I am looking that when-new-item-instance fires only on input focus only. any way to write this codes in any trigger? i tried in another trigger also. But its giving error (go_block restricted). Pls send your suggestions.
Thanks
Mano
|
|
|
Re: when-new-item-instance problem [message #312035 is a reply to message #311379] |
Mon, 07 April 2008 20:02  |
 |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Have you considered having a when-button-pressed trigger on an item based on 'block1'? In it have a single go_block then the loop and insert statment (you don't need the second go_block). Then all you have to do is press the button.
What happens if the button is pressed a second time?
David
|
|
|