duplocate detail [message #116022] |
Sat, 16 April 2005 06:53 |
jhsharma
Messages: 58 Registered: June 2004
|
Member |
|
|
i want to find the duplicate records based on multple columns e.g. uniqueness on emp,dept,cat( apart from primary key) in details block. I want it at the entry level only instead of commit process.
|
|
|
Re: duplocate detail [message #116116 is a reply to message #116022] |
Sun, 17 April 2005 21:41 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
I am not sure of what you mean' at entry' versus 'commit' process.
However, to retrieve only those records that are duplicated you can try something like the following in the 'where' clause:
emp, dept, cat in
(select emp, dept,cat
from tab
group by emp, dept, cat
having count(*) > 1)
This will give you the records for which there are duplicate entries. If you have two entries, delete one, and then requery, the singularly occurring record will not be displayed.
|
|
|
Re: duplocate detail [message #116425 is a reply to message #116116] |
Wed, 20 April 2005 00:34 |
jhsharma
Messages: 58 Registered: June 2004
|
Member |
|
|
dear guru
infact my exact problem is this i want to check the detail at the entry level itself. e.g suppose i have entered 2 detail records in form . As soon as i go to the record 3 and try to entered the dupliate entry . I should be stopped to do so.
regards
jhs
|
|
|
Re: duplocate detail [message #116426 is a reply to message #116022] |
Wed, 20 April 2005 01:03 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Use a when-validate-record trigger on your block to test whether the three fields have been used in a previous combination. If they have fail produce a message and fail the record.
You could also place a when-validate-item trigger on each field which tests if the three fields are populated (not null) and if so, test against the database.
|
|
|