Home » Developer & Programmer » Forms » How to handle duplicate value in oracle forms at runtime. (D2K6i , Developer suite 10g)
How to handle duplicate value in oracle forms at runtime. [message #639823] Fri, 17 July 2015 04:32 Go to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

I have created a database data block using emp table in scott schema.
and it is tabular type displaying 1o records at a time .

My requirement is at the time of entering value using forms at runtime .
when i go to next record and enter exact value which is already present in previous record in same column .
at that time i want to restrict user from entering duplicate value before he saves the record.

For ex i want to restrict duplicate entry for "ename" column :-
in first row entered value:-
empno=1234 , ename='ABC'. , job='salesman' ......
in second record record
empno= 2345 , ename ='ABC'

now it should display message/alert that 'ABC' value for ename is already present in first record.
so you cant enter it again before he saves the record.

Please tell the possible solutions.

[Updated on: Fri, 17 July 2015 04:33]

Report message to a moderator

Re: How to handle duplicate value in oracle forms at runtime. [message #639831 is a reply to message #639823] Fri, 17 July 2015 06:31 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Post each record as it's entered using the post builtin in the when-new-record-instance trigger.
Then simply put a select in the when-validate-item trigger to see if the value has already been entered.
Re: How to handle duplicate value in oracle forms at runtime. [message #639834 is a reply to message #639831] Fri, 17 July 2015 07:36 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Brother search on this forum by my msgs i have provided complete solution of your problem search mughals_king messages otherwise tell me i would send .FMB file i ahve already uploaded fmb on this forum check and download you will get you 100% solution you cant enter duplicate record in such field.


Regards




[Updated on: Fri, 17 July 2015 07:46]

Report message to a moderator

Re: How to handle duplicate value in oracle forms at runtime. [message #639836 is a reply to message #639834] Fri, 17 July 2015 09:58 Go to previous messageGo to next message
Littlefoot
Messages: 21592
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
In my opinion, the requirement is wrong. Why wouldn't there be two (or more) employees with the same name? That is a possible situation and certainly isn't a reason to discard any of those persons.

Because names aren't unique, another kind of a unique identifier has been "invented", such as social security number (or whatever that identifier is called where you live).
Re: How to handle duplicate value in oracle forms at runtime. [message #639837 is a reply to message #639834] Fri, 17 July 2015 10:03 Go to previous messageGo to next message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
There are several ways to test for duplicate records during data entry. One way, as cookiemonster mentioned, is to post all update/inserts and let the database report the duplicates (assuming there is a constraint on your table). This method is not always convenient and you need to check for duplicates before you send insert/updates to the database. There are several examples on the Internet (search: "Oracle Forms Duplicate Record Check") but my favorite is: Forms: How to Check for Duplicates using a Record Group. Admittedly, I wrote this article, but that is not the only reason this is my favorite solution. I like it because using Record Groups and understanding how they work enables you to implement them for other things besides duplicate checks. Another good option is Avoid duplicated records in a block. If neither of these work for you, run the search I mentioned and look at the other options that are out there...

Craig...
Re: How to handle duplicate value in oracle forms at runtime. [message #639839 is a reply to message #639823] Fri, 17 July 2015 10:33 Go to previous messageGo to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

@seniors , unique or any other constraint will only work when user will try to save records.
but i wanted to restrict duplicate values for a particular column while user is entering records one by one and navigating from record to record in a detail block.
what in that case if there arehundreds of records in a detail block and user saves records and gets error after entering 100 records .
so the main motto was t save time.
i have found the two solutions for that and will attach test fmb file tomorrow. but i was looking for some few alternatives too.
thanks for the comments .
Re: How to handle duplicate value in oracle forms at runtime. [message #639842 is a reply to message #639839] Fri, 17 July 2015 11:16 Go to previous messageGo to next message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
Both of the options I supplied links for are "Runtime" duplicate checks - not trip to the database needed.

Craig...
Re: How to handle duplicate value in oracle forms at runtime. [message #639848 is a reply to message #639842] Fri, 17 July 2015 19:02 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Generally when doing duplicate checks you need to make sure not only that user hasn't entered the same data twice but also that they haven't entered the same data as someone else. If that's the case here then you have no choice but to check the DB.
And let's be clear my suggested approach doesn't rely on constraints at all (though you should still have them on the table).
@jgjeetu - read up on what post does, it does not rely on the user pressing save.
Re: How to handle duplicate value in oracle forms at runtime. [message #639849 is a reply to message #639848] Fri, 17 July 2015 22:42 Go to previous messageGo to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

i am attaching working test file.

@cm yup i will go through as per everyone's suggestion and answers.
thanks all for the reply.
Re: How to handle duplicate value in oracle forms at runtime. [message #639850 is a reply to message #639831] Fri, 17 July 2015 22:57 Go to previous messageGo to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

1 more Smile
Re: How to handle duplicate value in oracle forms at runtime. [message #639851 is a reply to message #639837] Fri, 17 July 2015 23:19 Go to previous messageGo to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

@craigb , the 2nd one solution i have already used, and couldm't access zip file of 1st link.
can you please attach that here.
thanks
Re: How to handle duplicate value in oracle forms at runtime. [message #640386 is a reply to message #639851] Mon, 27 July 2015 16:12 Go to previous messageGo to next message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
What do you mean you, "Couldn't access zip file of 1st link."? Is it download link disabled or is it blocked by your firewall settings?

Craig...
icon7.gif  Re: How to handle duplicate value in oracle forms at runtime. [message #674578 is a reply to message #639837] Mon, 04 February 2019 04:34 Go to previous message
aspardeshi
Messages: 2
Registered: August 2012
Location: Pune
Junior Member
Avoid Duplicates link was fantastic and worked like a creampie for me.

Thanks buddy.
Previous Topic: Re validating LOV in Oracle forms
Next Topic: Webutil_file_transfer, Asynchronous
Goto Forum:
  


Current Time: Mon Sep 21 07:09:14 CDT 2020