Home » Developer & Programmer » Forms » How to attach add LOV to list item (10g, 10g developer suit, win 2000)
How to attach add LOV to list item [message #317969] Mon, 05 May 2008 02:45 Go to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Hi,

I am making a form and have a column for states (US). I created a LOV for US states (50). I want to see the attributes of this LOV in the list item that I added beside the states column so it looks as a drop down list and the user can select a state from the list.

How should I do this?

- Das
Re: How to attach add LOV to list item [message #318433 is a reply to message #317969] Tue, 06 May 2008 18:53 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What part of the default forms behaviour is not to your requirements?

Create the record_group of US states, base an LOV on this record_group remembering to point the 'Return Item' for the 'Column Names' in which you are interested, to the item you want populated. Then associate this LOV with an item so that it can be invoked or call it from a 'when-Button-Pressed' trigger via the 'show_lov' built-in.

David
Re: How to attach add LOV to list item [message #327330 is a reply to message #318433] Mon, 16 June 2008 02:01 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Hi,

Here is what I did as per your instructions.
(Following are based on the screen shot attached)

Motive - I want the cupboardno to be loaded when the form opens and a drop list to be displayed when the list item is pressed

Process Followed -

Added a List item beside the text item Cupboardno.
Created a LOV from the cupboardnos in the table cupboard (query - select cupboardno from cupboard). This automatically created a record group of the same name.
The cupboardno was selected as the return target (also tried the return target as the LIST ITEM)
Changed the name of the LOV to LOV_CUPBOARD (the record group name changed automatically).
Then tried to use show_lov built in function. Selected the 'WHEN-MOUSE-CLICKED' trigger
begin
  show_lov(LOV_CUPBOARD);
end;


Upon compiling it gives error

Quote:
identifier LOV_CUPBOARD must be declare


why doesn't the compile recognize the LOV name?
  • Attachment: LOV.gif
    (Size: 80.72KB, Downloaded 181 times)
Re: How to attach add LOV to list item [message #327434 is a reply to message #317969] Mon, 16 June 2008 07:07 Go to previous messageGo to next message
Martin Eysackers
Messages: 80
Registered: October 2005
Location: Belgium
Member
begin
  show_lov('LOV_CUPBOARD');
end;

Re: How to attach add LOV to list item [message #327660 is a reply to message #327434] Tue, 17 June 2008 03:03 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Thanks,

I had also forgotten to use a variable to get the output of the SHOW_LOV function but now I am not getting exactly what I was looking for.

declare
 a boolean;
begin
 a  show_lov('LOV_CUPBOARD');
end;


Attached is the LOV (lov_image.gif) that I see on my screen but I want it to look like a drop down list (drop_down_list.gif). When I press the list button the cupboardno column should drop down and let me select the cupboardno.

How do I do that?

  • Attachment: LOV_IMAGE.gif
    (Size: 95.42KB, Downloaded 148 times)
Re: How to attach add LOV to list item [message #327661 is a reply to message #327660] Tue, 17 June 2008 03:04 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
No Message Body
Re: How to attach add LOV to list item [message #327663 is a reply to message #327660] Tue, 17 June 2008 03:06 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Quote:
he output of the SHOW_LOV function but now I am not getting exactly what I was looking for.
Laughing


Quote:
he output of the SHOW_LOV function but now I am getting exactly what I was looking for.
Re: How to attach add LOV to list item [message #327768 is a reply to message #317969] Tue, 17 June 2008 09:00 Go to previous messageGo to next message
Martin Eysackers
Messages: 80
Registered: October 2005
Location: Belgium
Member
you cannot make an LOV appear to be a list item
if you want a listitem make one in your block and fill it based on a record group
if you don't know how please search the internet and online help first (brush up on your forms knowledge)

if you get stuck show us what you've tried and we'll gladly help you out
Re: How to attach add LOV to list item [message #327829 is a reply to message #327768] Wed, 18 June 2008 02:41 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Thanks, got it.

I am trying the drop down list now, using a record group, but getting an error. Attached is the screen shot with that error.

I searched the online help for the same and got this explanation.

Quote:
Cause: You tried to populate a list from a record group that does not exist.
Action: Make sure the record group exists.


but I have created the record (REC_CUPBOARD) and it is very much there. Here is the code for WHEN_MOUSE_CLICK trigger on the list item
BEGIN 

 RETRIEVE_LIST('LIST23', 'REC_CUPBOARD'); 
 CLEAR_LIST('LIST23'); 
 POPULATE_LIST('LIST23', 'REC_CUPBOARD');
		
end;


Have I missed anything?
Re: How to attach add LOV to list item [message #327858 is a reply to message #317969] Wed, 18 June 2008 04:04 Go to previous messageGo to next message
Martin Eysackers
Messages: 80
Registered: October 2005
Location: Belgium
Member
you must have made a typo or something,
have a look in your object navigator or in your code, can't help you there

however your code is not correct
you want to refresh your list item, that's ok
but not like this
retrieve_list overwrites your record group which you later use to repopulate your list item, so the same items get loaded, no use, furthermore you have to populate your record group :
declare
	status    number;
begin	
  clear_list('LIST23');
  status := populate_group('REC_CUPBOARD');
  populate_list('LIST23','REC_CUPBOARD');
end;

[Updated on: Wed, 18 June 2008 04:11]

Report message to a moderator

Re: How to attach add LOV to list item [message #327886 is a reply to message #327858] Wed, 18 June 2008 04:48 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Thanks for the reply.

I tried a few things but it still does not seem to work. I deleted the old list item and created a new one CUPBOARD_DROP_DOWN

I tried putting this code in WHEN_NEW_FORM_INSTANCE (form level) and WHEN_MOUSE_CLICK trigger on the list item but it does not show the list contents when I press the down arrow key of the drop down list


declare
	status number;
	
begin
	
	status := populate_group('REC_CUPBOARD');
	populate_list('CUPBOARD_DROP_DOWN','REC_CUPBOARD');
	
end;


Then I looked at the property details and I found that the data type for the list was CHAR and the CUPBOARDNO would return Number so I changed the datatype to Number (LIST_PROPERTY.gif) and tried to compile the form but it gave me error (type_error.gif)

When I manually type in the list items it works fine but that will not serve the purpose as that will be static.

What else can I try to get the cupboardno appear as as drop down list?
Re: How to attach add LOV to list item [message #327887 is a reply to message #327886] Wed, 18 June 2008 04:49 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
No Message Body
Re: How to attach add LOV to list item [message #328073 is a reply to message #317969] Wed, 18 June 2008 17:32 Go to previous messageGo to next message
Martin Eysackers
Messages: 80
Registered: October 2005
Location: Belgium
Member
try it without the when-mouse-click first
add this in your when-new-form-instance to see whether your query returns any results :

Message('The query retrieved '
            ||to_char(get_group_row_count('REC_CUPBOARD')) 
            ||' record(s)'); 
message(' ');            


also a list item can indeed only be char
the query your record group is based on has to have 2 columns both char

[Updated on: Wed, 18 June 2008 17:33]

Report message to a moderator

Re: How to attach add LOV to list item [message #328143 is a reply to message #328073] Thu, 19 June 2008 02:08 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Thanks..

This is what my WHEN_NEW_FORM_INSTANCE trigger code looks like

Quote:
declare
status number;

begin

status := populate_group('REC_CUPBOARD');
populate_list('CUPBOARD_DROP_DOWN','REC_CUPBOARD');

Message('The query retrieved '
||to_char(get_group_row_count('REC_CUPBOARD'))
||' record(s)');
message(' ');

end;


It gives two two messages first is the error message (list_item_population.gif - previous message) and the second shows that two records were retrieved (records_retrieved.gif) but still the list is not being populated.

Any guesses why?
Re: How to attach add LOV to list item [message #328295 is a reply to message #317969] Thu, 19 June 2008 11:53 Go to previous messageGo to next message
Martin Eysackers
Messages: 80
Registered: October 2005
Location: Belgium
Member
durgadas.menon wrote on Thu, 19 June 2008 09:08
It gives two two messages first is the error message (list_item_population.gif - previous message)
Any guesses why?



why ?
well forms tells you why in the error message
your query is not compatible with a listitem
as I clearly said before it has to have 2 columns, both char

please post the query used to fill your record group or change it accordingly

[Updated on: Thu, 19 June 2008 12:42]

Report message to a moderator

Re: How to attach add LOV to list item [message #328377 is a reply to message #328295] Fri, 20 June 2008 00:17 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Thanks..atlast

I was trying the following query to populate the list item

Quote:
/*cupboardno number(5)*/

select cupboardno from cupboard


then I tried what you said

/*author varchar2(20), category varchar2(10)*
  select author, category from books


and the list was populated with the author names. So what this means that the first column in the query will populate the list?

Thanks for the assistance

- Das


Re: How to attach add LOV to list item [message #328587 is a reply to message #317969] Fri, 20 June 2008 09:57 Go to previous message
Martin Eysackers
Messages: 80
Registered: October 2005
Location: Belgium
Member
don't you have access to online help ? Smile :
Description

Removes the contents of the current list and populates the list with the values from a record group.  The record group must be created at runtime and it must have the following two column (VARCHAR2) structure: 
Column 1:	Column 2: 
the list label	the list value 


Previous Topic: Trigger not working
Next Topic: no navigation happening
Goto Forum:
  


Current Time: Fri Dec 09 04:19:39 CST 2016

Total time taken to generate the page: 0.10756 seconds