validate from list in LOV [message #169467] |
Thu, 27 April 2006 00:10 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
juicyapple
Messages: 92 Registered: October 2005
|
Member |
|
|
I have two text fields in a form, batch no. and date. User will key in batch no. and select the date through LOV.
The LOV query as below:
select date1 from tbl1 where batch = :frmRec.batch
group by date1
If I set validate from list in LOV to Yes, it will only allow user key in date which is exist in LOV. If no records return from LOV, user is not allow to key in anything in the date field, am I right?
Please give idea/suggestion on how this can be done when no records is returned.
Thanks.
|
|
|
Re: validate from list in LOV [message #169470 is a reply to message #169467] |
Thu, 27 April 2006 00:38 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
RAS_SANKAR
Messages: 42 Registered: March 2006 Location: India
|
Member |
|
|
hi apple,
It is an alternative way of doing that u required.
set autodisplay of lov to FALSE
set validate from list to NO
write the following code in trigger when-validate-item
on bathno.
declare
b boolean;
c number;
begin
select count(*) into c from tab1 where batch=:frmRec.batch
if c>0 then
b := show_lov('batchlov');
end if;
end;
Ras.
|
|
|
|
Re: validate from list in LOV [message #169483 is a reply to message #169476] |
Thu, 27 April 2006 02:29 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/43055.jpg) |
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
Ras: doing a count to see whether ONE record exists? I'd opt to restrict the select or to work with a NO_DATA_FOUND or an OPEN-FETCH-CLOSE like below:
declare
b boolean;
c number := 0;
cursor c_test
is
select 1 x
from tab1
where batch = :frmRec.batch;
begin
open c_test;
fetch c_test into c;
close c_test;
if c=1 then
b := show_lov('batchlov');
end if;
end;
A little bit more code but you'll find it a lot better performing (certainly when working with large tables) ![Wink](images/smiley_icons/icon_wink.gif)
MHE
PS: u = you?
[Updated on: Thu, 27 April 2006 02:29] Report message to a moderator
|
|
|
Re: validate from list in LOV [message #169486 is a reply to message #169483] |
Thu, 27 April 2006 03:13 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
RAS_SANKAR
Messages: 42 Registered: March 2006 Location: India
|
Member |
|
|
I think we can also write like this
declare
b boolean;
c number ;
begin
select 1 into c from tab1 where batch = :frmRec.batch;
b := show_lov('batchlov');
exception
when no_data_found then
null;
end;
|
|
|
|