Home » Developer & Programmer » Forms » Correct trigger for GO_RECORD, GO_ITEM
Correct trigger for GO_RECORD, GO_ITEM [message #395935] Fri, 03 April 2009 03:33 Go to next message
Nshan
Messages: 62
Registered: February 2009
Member
Hi,
I am using one form.
In that i want to do some run time validation(Duplication Check).
At the time of saving i should be alerted that i have entered multiple records in a form.

Ex:

Reason_code path
----------- ------------
CM1 CSA
CM1 CSA

if i go and save then it should alert me for multiple entries.
For navigation purpose i used GO_RECORD, FIRST_RECORD, GO_ITEM.
Those builtin's are not possible in pre & post and validation an ON triggers.
Can any one tell which trigger i should use to call my duplication check procedure.
Thanks in advance!
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395942 is a reply to message #395935] Fri, 03 April 2009 04:16 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If there's a unique index (or primary key) created on those columns on the database level, you don't have to do anything as Oracle will inform you that duplicate combinations are not allowed.

If you, however, insist on your solution, search the board - such a question has already been discussed. You might want to view Francois Degrelle's suggestion (you'll find it among search results).
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395951 is a reply to message #395942] Fri, 03 April 2009 05:10 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
I am not using any unique index on that column.
I have gone through Kevin D Clarke article.
But can you get me navigation as well as comparison clearly.
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395954 is a reply to message #395935] Fri, 03 April 2009 05:23 Go to previous messageGo to next message
mm_kanish05
Messages: 493
Registered: January 2007
Location: Chennai
Senior Member

why


Quote:
At the time of saving


cant it, at entering level.

kanish
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395956 is a reply to message #395954] Fri, 03 April 2009 05:26 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
Anything is k for my problem.
While entering or while saving.
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395958 is a reply to message #395935] Fri, 03 April 2009 05:32 Go to previous messageGo to next message
cookiemonster
Messages: 13963
Registered: September 2008
Location: Rainy Manchester
Senior Member
Post each record as it's entered then use a cursor in the when-validate-item to check if the value already exists.

You do not need to use navigation for this at all.
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395959 is a reply to message #395935] Fri, 03 April 2009 05:35 Go to previous messageGo to next message
mm_kanish05
Messages: 493
Registered: January 2007
Location: Chennai
Senior Member

Try and apply for your logic


Partno	:= :System.Current_value;
First_record;
Loop
If :System.LAST_Record = 'TRUE' then
Exit;
End if; 
If :System.Cursor_Record = Rec_no then
Exit;
End if; 
If :Blockname.Itemname = Partno then
Message('This Part No. has been already entered');
Raise form_trigger_failure;
Exit;
End if;
Next_Record; 
End Loop;


kanish
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395960 is a reply to message #395935] Fri, 03 April 2009 05:39 Go to previous messageGo to next message
cookiemonster
Messages: 13963
Registered: September 2008
Location: Rainy Manchester
Senior Member
And what trigger would you put that code in?
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395961 is a reply to message #395958] Fri, 03 April 2009 05:41 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
Can you give me some sample code for cursor example?
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395963 is a reply to message #395959] Fri, 03 April 2009 05:44 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
In which trigger i should place
What is tat rec_no??
Why it is used??
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395964 is a reply to message #395935] Fri, 03 April 2009 05:46 Go to previous messageGo to next message
mm_kanish05
Messages: 493
Registered: January 2007
Location: Chennai
Senior Member

hi

@cookiemonster
Quote:
And what trigger would you put that code in?


at key-next-item

@Nshan
Quote:
Can you give me some sample code for cursor example?


Google it, lot and lot you can.

Sorry to Nshan

Quote:
Rec_no := :System.Cursor_Record;


Kanish

[Updated on: Fri, 03 April 2009 05:53]

Report message to a moderator

Re: Correct trigger for GO_RECORD, GO_ITEM [message #395965 is a reply to message #395964] Fri, 03 April 2009 05:53 Go to previous messageGo to next message
cookiemonster
Messages: 13963
Registered: September 2008
Location: Rainy Manchester
Senior Member
mm_kanish05 wrote on Fri, 03 April 2009 11:46
hi

@cookiemonster
Quote:
And what trigger would you put that code in?


at key-next-item




What happens if the user uses the mouse to navigate out of the item?
Or shift-tab?
Or key-down?

Nshan wrote on Fri, 03 April 2009 11:41

Can you give me some sample code for cursor example?

If you don't know how to write a cursor to find a single record I suggest you start reading the manuals.
If you don't know how to post - it's an oracle forms built-in, look it up.
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395966 is a reply to message #395959] Fri, 03 April 2009 05:54 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
Hi,

Can you tell me what is Rec_no??
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395967 is a reply to message #395935] Fri, 03 April 2009 06:00 Go to previous messageGo to next message
mm_kanish05
Messages: 493
Registered: January 2007
Location: Chennai
Senior Member

check my previous updated the reply.

kanish
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395976 is a reply to message #395965] Fri, 03 April 2009 07:05 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
I am asking how to use cursor variables in side the code
not basic cursor things.

Ex:

DECLARE
cursor cur is select :BlockName.reason_code
from dual;
BEGIN
for i in cur
loop
If (i.reason_code = r_code) then
FND_MESSAGE.SET_STRING('Multiple entries for reason code');
FND_MESSAGE.SHOW;
RAISE FORM_TRIGGER_FAILURE;
Exit;
End if;
End Loop;
End;


I think i cant use i.reason_code???

I am asking how to access cursor values those things.
I am very new to forms thatz y i am asking.
Re: Correct trigger for GO_RECORD, GO_ITEM [message #395988 is a reply to message #395935] Fri, 03 April 2009 07:43 Go to previous messageGo to next message
cookiemonster
Messages: 13963
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why do you think you need a cursor to get the value of an item in a form?
You need to use a cursor to see if that value exists in the database.
Re: Correct trigger for GO_RECORD, GO_ITEM [message #396260 is a reply to message #395988] Sun, 05 April 2009 23:14 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
I am not storing those values in database.
Simply i want to do run time validation.
While leaving that particular field or at the time of saving.
Any one can help me in coding part.

Re: Correct trigger for GO_RECORD, GO_ITEM [message #396517 is a reply to message #395976] Tue, 07 April 2009 01:27 Go to previous messageGo to next message
itech
Messages: 173
Registered: May 2008
Location: Fsd, Pakistan
Senior Member

Nshan wrote on Fri, 03 April 2009 17:05
I am asking how to use cursor variables in side the code
not basic cursor things.

Ex:

DECLARE
cursor cur is select :BlockName.reason_code
from dual;
BEGIN
for i in cur
loop
If (i.reason_code = r_code) then
FND_MESSAGE.SET_STRING('Multiple entries for reason code');
FND_MESSAGE.SHOW;
RAISE FORM_TRIGGER_FAILURE;
Exit;
End if;
End Loop;
End;


I think i cant use i.reason_code???

I am asking how to access cursor values those things.
I am very new to forms thatz y i am asking.


i dont think it will iterate for the whole block records.

u first ned to go the the first record, then iterate using next_record until u reach teh last record, u need to skip the current record (since it will find a duplicate value)

and u can apply your code logic at when-validate-record trigger.

pls try and tell.
Re: Correct trigger for GO_RECORD, GO_ITEM [message #396568 is a reply to message #395935] Tue, 07 April 2009 04:16 Go to previous messageGo to next message
cookiemonster
Messages: 13963
Registered: September 2008
Location: Rainy Manchester
Senior Member
since when can you use next_record in when-validate-record?
Re: Correct trigger for GO_RECORD, GO_ITEM [message #396577 is a reply to message #396568] Tue, 07 April 2009 04:35 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
I have got the solution...
Thanks for all your reply....
Re: Correct trigger for GO_RECORD, GO_ITEM [message #396616 is a reply to message #396577] Tue, 07 April 2009 06:02 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
In that case, it would be polite to share the solution with the rest of the community.
Re: Correct trigger for GO_RECORD, GO_ITEM [message #396622 is a reply to message #396616] Tue, 07 April 2009 06:13 Go to previous messageGo to next message
Nshan
Messages: 62
Registered: February 2009
Member
Solved based on Kevin D Clarke's article...
Re: Correct trigger for GO_RECORD, GO_ITEM [message #396640 is a reply to message #396622] Tue, 07 April 2009 07:07 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
... whose URL is ...?
Re: Correct trigger for GO_RECORD, GO_ITEM [message #396800 is a reply to message #396640] Wed, 08 April 2009 01:37 Go to previous message
Nshan
Messages: 62
Registered: February 2009
Member
http://sheikyerbouti.developpez.com/duplicates/duplicates.htm
Previous Topic: Record Status
Next Topic: How to get information from previous row (Was appended to "Canvas scroll bars..")
Goto Forum:
  


Current Time: Mon Feb 03 20:36:37 CST 2025