Home » Developer & Programmer » Forms » Populate error message when inserting duplicated field in primary key? (Solaris)
Populate error message when inserting duplicated field in primary key? [message #391316] Wed, 11 March 2009 14:42 Go to next message
michaelv
Messages: 20
Registered: November 2006
Location: rockville, MD
Junior Member
Hi,
I have the problem which i have already searched the forum but no luck. Here is the problem:
Ex: I use very simple form

Form AAA has field A1 which is primary key.
When insert record, the error message will show when saving.
However, i would like to popup the message showing that field entered is duplicated.

I have no problem checking it if data is already in the table, but during the insert.

Table AAA
field A1
a
b
c

field A1
a
b
c
d
d
If i enter d twice (a,b,c are already in the table), it won't check for it until i save

Please help.

thanks.
Re: Populate error message when inserting duplicated field in primary key? [message #391324 is a reply to message #391316] Wed, 11 March 2009 17:22 Go to previous messageGo to next message
cookiemonster
Messages: 12403
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is the problem what the message says or the point at which the message appears?
Re: Populate error message when inserting duplicated field in primary key? [message #391401 is a reply to message #391316] Thu, 12 March 2009 02:24 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The point, I presume.

Because, it would fail at COMMIT, eventually. He'd probably want to warn the user during the "typing" phase. If so, check this Francois Degrelle's article.
Re: Populate error message when inserting duplicated field in primary key? [message #391432 is a reply to message #391316] Thu, 12 March 2009 04:33 Go to previous messageGo to next message
cookiemonster
Messages: 12403
Registered: September 2008
Location: Rainy Manchester
Senior Member
That was my first guess but I thought I'd better check.

Had a look at the article - that approach would never have occurred to me.
System I worked on - we just made sure all datablocks had a WHEN-NEW-RECORD-INSTANCE that did a post.
Then checks like this become a simple select.
Re: Populate error message when inserting duplicated field in primary key? [message #391448 is a reply to message #391432] Thu, 12 March 2009 05:11 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I agree - POST is probably the simplest way to do that. Or, if possible (i.e. if it wouldn't affect the process), COMMIT would also raise an exception (and you wouldn't have to code it at all!).

If you have some time, check Francois Degrelle's blog - it contains several astonishing (from my point of view) tips and tricks.
Re: Populate error message when inserting duplicated field in primary key? [message #391558 is a reply to message #391448] Thu, 12 March 2009 10:10 Go to previous messageGo to next message
michaelv
Messages: 20
Registered: November 2006
Location: rockville, MD
Junior Member
Hi all, sorry for late response.

I first use when-validate-item, but POST won't work on this.
I want to check by the time user enter data. Let say , i have the following in database
AAA
BBB
CCC

If i enter DDD, it's ok. Then, without saving, i enter the next record DDD again. At this point, if i save data, i will get the unique constraint error as it's supposed to be ( can't duplicate primary key).

What i would like is to pop the message to user that second DDD is already in the field.

So, POST won't work on WHEN-VALIDATE-ITEM. However, POST works in WHEN-NEW-RECORD-INSTANCE, but this creats another problem as when you create a new record, POST is posting empty record and this message is irritated to the user.

thanks.
Re: Populate error message when inserting duplicated field in primary key? [message #391559 is a reply to message #391316] Thu, 12 March 2009 10:18 Go to previous message
cookiemonster
Messages: 12403
Registered: September 2008
Location: Rainy Manchester
Senior Member
Write a procedure to see if there's anything to post.
Call this from the WHEN-NEW-RECORD-INSTANCE.
You can also change the system.message_level in the procedure if you want.
Previous Topic: Help with FND_REQUEST.SUBMIT_REQUEST
Next Topic: navigating through menus problem
Goto Forum:
  


Current Time: Sun Dec 04 00:29:28 CST 2016

Total time taken to generate the page: 0.09384 seconds