Save Record [message #133740] |
Mon, 22 August 2005 00:56 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
master
Messages: 10 Registered: June 2005 Location: India
|
Junior Member |
|
|
Hi,
I have created a form which as two block as master and detail.
I am facing two problem in my detail block.
First: When I populate records in detail block, it prompt a message 'Do you want to save record ?'.
Second : When I alter any value in detail block and move to next record, it prompt a message 'Do you want to save record ?'
Is there any way where, system don't prompt me a message for saving record and user can continue with changes and save the records when he desire.
|
|
|
|
Re: Save Record [message #133757 is a reply to message #133740] |
Mon, 22 August 2005 02:12 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
master
Messages: 10 Registered: June 2005 Location: India
|
Junior Member |
|
|
I am using default relationship.
The relation between Master and Detail is set and it is working fine.
Master
|
|
|
|
|
|
Re: Save Record [message #134022 is a reply to message #133740] |
Tue, 23 August 2005 05:53 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
master
Messages: 10 Registered: June 2005 Location: India
|
Junior Member |
|
|
David,
Thanks for your update.
As I shown in screen shot, I am populating the data from other table into detail block which all column based on a table.
Is there anyway where we can populate the data and avoid this alert.
The other option can be to create a non-database block and populdate the value and then save it manually.
This option will work fine while inserting new record but for update and delete we need to populate the data again.
Pl. let me know your view point.
Master
|
|
|
Re: Save Record [message #134025 is a reply to message #134022] |
Tue, 23 August 2005 06:08 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
danycd
Messages: 6 Registered: April 2005 Location: France
|
Junior Member |
|
|
I already encountered this problem.
What kind of operations do you make in the POST-QUERY trigger of you detail block ?
As your detail block is based on a table, if you manipulate based fields in this trigger the record status change.
So, I recommand you to use the following command at the end of the POST-QUERY trigger :
SET_RECORD_PROPERTY(TO_NUMBER(NAME_IN('SYSTEM.TRIGGER_RECORD')), <DETAIL_BLOCK_NAME>, STATUS, QUERY_STATUS);
|
|
|
Re: Save Record [message #134050 is a reply to message #133740] |
Tue, 23 August 2005 07:41 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
master
Messages: 10 Registered: June 2005 Location: India
|
Junior Member |
|
|
Hi,
I am not using post-query trigger to populate detail block.
While inserting a new record, when user click on button and
in when-button-pressed trigger, I have used cursor to get records from tables and populate the same into detail block.
I have tried to set_record_property but it didn't work.
Master
|
|
|
Re: Save Record [message #134210 is a reply to message #134050] |
Tue, 23 August 2005 19:50 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
The following is from the reference manual on set_record_property.Quote: | The following table illustrates the valid transition states of a record.
Current Status Target Status
NEW QUERY INSERT CHANGED
NEW yes yes1 yes2 no
QUERY yes4 yes no yes
INSERT yes4 yes3 yes no
CHANGED yes4 no no yes 1 Adheres to the rules described in footnotes 2 and 3.
2 This transition is not allowed in query mode, because QUERY and INSERT are not valid in query mode.
3 If this transition is performed while Runform is running in Unique Key mode and not all of the transactional triggers exist, then you must enter a valid value in the ROWID field. Put another way, if you are connected to a non-ORACLE data source that does not support ROWID, but you are using a unique key, you must supply the key for a record that goes from Insert to Query, in one of the transactional triggers, either On-Lock, On-Update, or On-Delete. Otherwise Form Builder returns an error.
4 Records that have been changed but not yet committed or cleared cannot be assigned a status of NEW.
| This may explain why your attempt to use the set-record_property did not work.
Master, you say you are not using the post-query trigger to populate the detail block, but you have said it does exist. Please supply the contents of the detail block Post-Query trigger.
I asked Quote: | Please verify that you understand the difference between When-New-Record-Instance and When-Create-Record. The first fires for every record. The second fires on 'insert' and when you go 'past' the 'last' record
| Please be so kind as to respond to this question.
David
|
|
|
Re: Save Record [message #134237 is a reply to message #133740] |
Wed, 24 August 2005 01:10 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
master
Messages: 10 Registered: June 2005 Location: India
|
Junior Member |
|
|
Hi,
There is minor error in my earlier post about triggers.
There is no post-query trigger on Detail Block.
Detail Block has following triggers.
BLOCK - DETAIL
ON-POPULATE-DETAILS (Oracle generated trigger)
PRE-DELETE
ON-INSERT
As I mentioned in my earlier posting, I am populating Detail Block only when user click on 'POPULATE EXPENSE' button as shown in image.
I have written WHEN-BUTTON-PRESSED trigger on 'POPULATE EXPENSE' button.
The code is as follows:
declare
alt_id alert;
al_butt number;
ln_amt number;
ln_rcpt_srno number;
ln_st_totamt number;
CURSOR c_billhead IS
select M_BILL_DETAIL.BILL_CD,BILL_NAME,ST_FLG
FROM M_BILL_DETAIL,M_BILLHEAD
WHERE M_BILLHEAD.BILL_CD = M_BILL_DETAIL.BILL_CD
AND M_BILL_DETAIL.CO_CD = :T_BILL.CO_CD
AND M_BILL_DETAIL.BR_CD = :T_BILL.BR_CD
AND M_BILL_DETAIL.VOU_TYPE_CD = :T_BILL.VOU_TYPE_CD
order by m_bill_detail.bill_cd;
lr_billhead c_billhead%rowtype;
Cursor c_billexp (lc_bill_cd VARCHAR2) is
Select co_cd,br_cd,party_cd,bill_cd,expense_cd
from m_party_billexpense
where co_cd = :t_bill.co_cd
and br_cd = :t_bill.br_cd
and party_cd = :t_bill.party_cd
and bill_cd = lc_bill_cd;
lr_billexp c_billexp%rowtype;
Cursor c_jobexpense (lc_expense_cd VARCHAR2, ln_job_no NUMBER) is
select t_voucher.vou_no,t_voucher_dtl.vou_srno,t_voucher_dtl.expense_cd,
t_voucher_dtl.expense_amt
from t_voucher,t_voucher_dtl
where t_voucher.co_cd = :t_bill.co_cd
and t_voucher.br_cd = :t_bill.br_cd
and t_voucher.work_blk = :t_bill.work_blk
and t_voucher.job_type_cd = :t_bill.nbt_job_type_cd
and t_voucher.job_no = ln_job_no
and t_voucher_dtl.co_cd = t_voucher.co_cd
and t_voucher_dtl.br_cd = t_voucher.br_cd
and t_voucher_dtl.work_blk = t_voucher.work_blk
and t_voucher_dtl.vou_type_cd = t_voucher.vou_type_cd
and t_voucher_dtl.vou_no = t_voucher.vou_no
and t_voucher_dtl.expense_cd = lc_expense_cd;
lr_jobexpense c_jobexpense%rowtype;
Cursor c_jobrcpt (ln_vou_no NUMBER, ln_vou_srno NUMBER) is
select vou_no,vou_srno,recp_no,recp_date,recp_amt
from t_voucher_rcpt
where t_voucher_rcpt.co_cd = :t_bill.co_cd
and t_voucher_rcpt.br_cd = :t_bill.br_cd
and t_voucher_rcpt.work_blk = :t_bill.work_blk
and t_voucher_rcpt.vou_no = ln_vou_no
and t_voucher_rcpt.vou_srno = ln_vou_srno;
lr_jobrcpt c_jobrcpt%rowtype;
begin
if (:system.current_block != 'T_BILL_DTL') then
go_block('T_BILL_DTL');
end if;
:global.ln_st_totamt := 0;
IF :SYSTEM.BLOCK_STATUS = 'NEW' THEN
FOR lr_billhead IN c_billhead LOOP
ln_amt := 0;
open c_billexp(lr_billhead.bill_cd);
fetch c_billexp into lr_billexp;
While lr_billexp.co_cd = :t_bill.co_cd
and lr_billexp.br_cd = :t_bill.br_cd
and lr_billexp.bill_cd = lr_billhead.bill_cd
and c_billexp%FOUND Loop
open c_jobexpense(lr_billexp.expense_cd,:t_bill_job.job_no);
fetch c_jobexpense into lr_jobexpense;
While lr_billexp.expense_cd = lr_jobexpense.expense_cd
and c_jobexpense%FOUND Loop
ln_amt := ln_amt + lr_jobexpense.expense_amt;
:t_bill.bill_amt := nvl(:t_bill.bill_amt,0) + lr_jobexpense.expense_amt;
open c_jobrcpt(lr_jobexpense.vou_no,lr_jobexpense.vou_srno);
fetch c_jobrcpt into lr_jobrcpt;
ln_rcpt_srno := 0;
While lr_jobexpense.vou_no = lr_jobrcpt.vou_no
and lr_jobexpense.vou_srno = lr_jobrcpt.vou_srno
and c_jobrcpt%FOUND Loop
ln_rcpt_srno := ln_rcpt_srno + 1;
:t_bill_rcpt.bill_srno := ln_rcpt_srno;
:t_bill_rcpt.recp_no := lr_jobrcpt.recp_no;
:t_bill_rcpt.recp_date := lr_jobrcpt.recp_date;
:t_bill_rcpt.recp_amt := lr_jobrcpt.recp_amt;
fetch c_jobrcpt into lr_jobrcpt;
End loop;
close c_jobrcpt;
fetch c_jobexpense into lr_jobexpense;
End loop;
close c_jobexpense;
fetch c_billexp into lr_billexp;
End loop;
close c_billexp;
:T_BILL_DTL.BILL_CD := lr_billhead.BILL_CD;
:T_BILL_DTL.BILL_NAME := lr_billhead.BILL_NAME;
:T_BILL_DTL.BILL_AMT := ln_amt;
CREATE_RECORD;
END LOOP;
first_record;
else
raise form_trigger_failure;
end if;
go_item('T_BILL_DTL.BILL_AMT');
synchronize;
SET_RECORD_PROPERTY(TO_NUMBER(NAME_IN('SYSTEM.TRIGGER_RECORD')), 't_bill_DTL', STATUS, insert_STATUS);
end;
Master
|
|
|
|
Re: Save Record [message #134280 is a reply to message #133740] |
Wed, 24 August 2005 03:11 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
master
Messages: 10 Registered: June 2005 Location: India
|
Junior Member |
|
|
David,
I have understood the difference between When-New-Record-Instance and When-Create-Record.
Here is a code of WHEN-NEW-RECORD-INSTANCE at Form Level.
:system.message_level:=25;
POST;
:system.message_level:=0;
Master
|
|
|
|
|
|
Re: Save Record [message #570645 is a reply to message #538585] |
Tue, 13 November 2012 09:12 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](//www.gravatar.com/avatar/6d6ee9000ee57dcf6a0e98bfa70849cf?s=64&d=mm&r=g) |
D_ORA
Messages: 32 Registered: November 2012 Location: UK
|
Member |
|
|
I appreciated the way David sincerely explaining the things..Thanks a lot for your sincere time
|
|
|