Problem in Showing Alert [message #394597] |
Sat, 28 March 2009 05:35 |
sivajyothi.kalikiri
Messages: 29 Registered: March 2009
|
Junior Member |
|
|
Dear All,
What's my requirement is, in Detail block if have one item ACCNM, If that has service tax flag then i should display one alert message, service tax is applicable or not.If i click button1 i.e YES, i should get service tax as ACCNM and its corresponding code in the next record.
I am getting everything, but the alert message is coming twice.
I wrote the following code in WHEN-NEW-RECORD-INSTANCE
DECLARE
v_chkActive VARCHAR2(10);
v_ret_alert NUMBER;
BEGIN
GO_BLOCK('T_CBJ_DTL');
FIRST_RECORD;
IF :T_CBJ_DTL.ACCD IS NOT NULL THEN
SELECT ser_tax
INTO v_chkactive
FROM m_acmst
WHERE accd = :T_CBJ_DTL.ACCD;
IF v_ChkActive = 'Y'
THEN
v_ret_alert := show_alert('SERVICETAX_ALERT');
IF v_ret_alert = ALERT_BUTTON1
THEN
NEXT_RECORD;
:T_CBJ_DTL.SL_NO := :SYSTEM.CURSOR_RECORD;
:T_CBJ_DTL.ACCD := 9695;
:T_CBJ_DTL.ACNM := 'Service Tax';
END IF;
END IF;
END IF;
END; [EDITED by LF: applied [code] tags]
[Updated on: Sat, 28 March 2009 16:10] by Moderator Report message to a moderator
|
|
|
Re: Problem in Showing Alert [message #394613 is a reply to message #394597] |
Sat, 28 March 2009 11:22 |
|
that can because u are alling
NEXT_RECORD;
and this in turn call the when-new-record-instance trigger.
i think u are applying the logic at wrong palce / trigger.
why u are using
GO_BLOCK('T_CBJ_DTL');
FIRST_RECORD;
as user can navigate to it from master block to detail block. you can set the property to change data block for the master block.
|
|
|
|
Re: Problem in Showing Alert [message #394734 is a reply to message #394732] |
Sun, 29 March 2009 23:54 |
sivajyothi.kalikiri
Messages: 29 Registered: March 2009
|
Junior Member |
|
|
It will check the first recoed in the detail block whether it has service tax or not, if it is there means it should show alert message as service tax is applicable or not, if i press 'YES' means it should go the next record and print accd as 9695 and acnm as service tax, where acnm and accd are fields in the detail block.
|
|
|
|
Re: Problem in Showing Alert [message #394814 is a reply to message #394597] |
Mon, 30 March 2009 07:04 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
As itech suggested you're doing this in the wrong place.
You shouldn't try and use WHEN-NEW-RECORD instance - even if you got it to stop showing the alert twice do you want it to show the alert everytime the user navigates to the record in question?
Consider using a button.
That said, why aren't you creating this 2nd record at the same time as the first?
|
|
|
Re: Problem in Showing Alert [message #394820 is a reply to message #394814] |
Mon, 30 March 2009 07:24 |
sivajyothi.kalikiri
Messages: 29 Registered: March 2009
|
Junior Member |
|
|
i suggested to my project leader of using a button.
he doesn't want to put a button.
i tried with other triggers also WHEN-VALIDATE-RECORD by removing NEXT_RECORD and GO_BLOCK code.
it's not working. when i removes NEXT_RECORD means it will over write the first_record.
How can i create 2nd record at the same time as the first.
i don't have any idea. can u tell me how to get that.
Actually i used one pushbutton to get first record accd,acnm fields.
i asked my project leader i will use that push button to get second record fields accd,acnm.
But he is not agreeing for that. after entering the last item in the first record only he wants to display the alert message
and should display the fields accd,acnm in second record.
What is the solution for this.
|
|
|
Re: Problem in Showing Alert [message #394861 is a reply to message #394597] |
Mon, 30 March 2009 10:58 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Let's just clarify what the process is.
Is it like this:
1) user enters record in T_CBJ_DTL block.
2) If the ser_tax for the entered account is 'Y' then you want an alert to appear.
3) If the user clicks on Yes then you want a new record to appear in the T_CBJ_DTL block with some hard-coded values.
I'm assuming that the WHEN-NEW-RECORD-INSTANCE trigger from your first post is on the T_CBJ_DTL block?
|
|
|
|
|
|