Multiple rows uniqueness validation [message #331002] |
Wed, 02 July 2008 02:06 |
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 #331292 is a reply to message #331255] |
Wed, 02 July 2008 23:12 |
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
|
|
|
|
|
|