Home » Developer & Programmer » Forms » how to check duplicate values in a grid (details) data block
how to check duplicate values in a grid (details) data block [message #87519] Mon, 10 January 2005 23:40 Go to next message
Mohan G
Messages: 36
Registered: August 2004
Member
hello
how to restrict entering duplicate values in one item (unique field)
i have tried setting the primary key property of that item to "yes", but doesn't work ...
Re: how to check duplicate values in a grid (details) data block [message #87528 is a reply to message #87519] Tue, 11 January 2005 06:08 Go to previous messageGo to next message
bargou
Messages: 3
Registered: January 2005
Junior Member
try the trigger when_validate_item and put the pl/sql
eg :
select code into cursor from table where code = :block.code
if the code exist then
message('try another code')
else
null;
end if;
Re: how to check duplicate values in a grid (details) data block [message #87538 is a reply to message #87528] Wed, 12 January 2005 06:33 Go to previous messageGo to next message
Mohan G
Messages: 36
Registered: August 2004
Member
yes i know that method but can i set any property of the block or the item not to allow duplicate values ?
Re: how to check duplicate values in a grid (details) data block [message #87541 is a reply to message #87538] Thu, 13 January 2005 02:59 Go to previous messageGo to next message
Kapil
Messages: 145
Registered: May 2002
Senior Member
But you can try is insert whatever value user Enters into a PL/SQL table and everytime user Enters a new value match it with existing value in PL/SQL table. If it exists then give error.
Re: how to check duplicate values in a grid (details) data block [message #87547 is a reply to message #87519] Fri, 14 January 2005 01:45 Go to previous messageGo to next message
oralover
Messages: 97
Registered: January 2005
Member
try this, you can check duplicates without saving in database.

FUNCTION chk_the_duplicate(your_field data_type, rec_no number) RETURN CHAR IS
total_records number:=0;
ret_val varchar2(1):='0';
BEGIN
last_record;
total_records:=to_number(:system.cursor_record);
first_record;
for i in 1..total_records loop
if to_number(:system.cursor_record) != rec_no then
if :BLOCK_NAME.your_unique_field = your_field then
ret_val := '1'; -- this will indicate that Duplicate found
exit;
end if;
end if;
if to_number(:system.cursor_record) = total_records then
exit;
else
next_record;
end if;
end loop;
return(ret_val);
END;
Re: how to check duplicate values in a grid (details) data block [message #87571 is a reply to message #87547] Mon, 17 January 2005 04:18 Go to previous message
Mohan G
Messages: 36
Registered: August 2004
Member
ty oralover
i have tried the same. but i am lookin for a simple solution like setting a property to that item ..
Previous Topic: Very very urgent.
Next Topic: Sub menus not working
Goto Forum:
  


Current Time: Thu Sep 19 10:45:43 CDT 2024