Home » Developer & Programmer » Forms » Multiple rows uniqueness validation
Multiple rows uniqueness validation [message #331002] Wed, 02 July 2008 02:06 Go to next message
svloke
Messages: 23
Registered: May 2007
Location: Mumbai
Junior Member
Dear Friends,
In a multiple row data block, I want to check the uniqueness of one column before commiting the form.

The said column(Form field) is a list Item containing names of equipment. The other fields are related to that equipment. I need to have one equipment only once on the form. How to maintain the uniquness?

Please guide.
svloke
Re: Multiple rows uniqueness validation [message #331255 is a reply to message #331002] Wed, 02 July 2008 15:17 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Search the board. The same question has been asked and answered recently.
Re: Multiple rows uniqueness validation [message #331292 is a reply to message #331255] Wed, 02 July 2008 23:12 Go to previous messageGo to next message
svloke
Messages: 23
Registered: May 2007
Location: Mumbai
Junior Member
Dear Sir,
While searching, I found that validation can be done when commiting the form. I need it at data block level, or at the end of the last field of the datablock current row.
Any way I tried the following code and succeeded.

-------------------
declare
equpt varchar2(10);
alert_button number;
cur_rec NUMBER;
i number(3);
n number(3);

begin
cur_rec := Get_Block_Property('sam_availability', CURRENT_RECORD);
equpt :=:sam_availability.eqpt ;
first_record;
for i in 1..(cur_rec-1) loop
IF :sam_availability.eqpt = equpt then
alert_button := show_alert('rec_exist_alert');
RAISE Form_Trigger_Failure;
go_item(':sam_availability.eqpt');
else
go_item('sam_availability.shift_1hh');
end if;
n := i+1;
next_record;
end loop;
next_item;
end;
---------------------------------
I request you to modify the above code, if it can be made still simpler.

svloke

Re: Multiple rows uniqueness validation [message #331363 is a reply to message #331292] Thu, 03 July 2008 02:21 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If I remember well, solution to the problem was quite similar to yours (i.e. didn't require COMMIT in order to raise DUP-VAL-ON-INDEX exception, but searched through data entered in a block).
Re: Multiple rows uniqueness validation [message #338158 is a reply to message #331292] Mon, 04 August 2008 00:49 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you solved your problem?

David
Re: Multiple rows uniqueness validation [message #338410 is a reply to message #338158] Mon, 04 August 2008 21:55 Go to previous message
svloke
Messages: 23
Registered: May 2007
Location: Mumbai
Junior Member
Hi! djmartin!
Yes! I have solved it myself long back.

Please see the thread.

Regards,
Svloke
Previous Topic: how we upload a photo from my computer to the form?
Next Topic: How to get display item name at the run time in form 6i
Goto Forum:
  


Current Time: Sun Feb 09 23:55:21 CST 2025