Home » Developer & Programmer » Forms » LOV does not display
icon9.gif  LOV does not display [message #144412] Wed, 26 October 2005 07:06 Go to next message
tornup
Messages: 13
Registered: February 2005
Location: Trinidad
Junior Member

Hi,
I have a problem with displaying a LOV, now I have used the search, but I could not find a similar problem with a solution. This is what I've done:

1. Created a record group at design time
2. Created LOV at design time
3. Programmatically created a new record group using CREATE_GROUP and I populated it using SET_GROUP_NUMBER/CHAR_CELL because my query is not a simple query.
4. Changed record group of the LOV created at design time to new record group created in step 3, by using SET_LOV_PROPERTY
5. Display LOV using SHOW_LOV.

When I click on the LOV button the LOV does not display, and I do not get any errors. Can someone please help. Thanks.

Nina
Re: LOV does not display [message #144415 is a reply to message #144412] Wed, 26 October 2005 07:08 Go to previous messageGo to next message
kiran
Messages: 503
Registered: July 2000
Senior Member
Can you post the code that you had written.

--Kiran.

[Updated on: Wed, 26 October 2005 07:09]

Report message to a moderator

Re: LOV does not display [message #144421 is a reply to message #144415] Wed, 26 October 2005 07:17 Go to previous messageGo to next message
tornup
Messages: 13
Registered: February 2005
Location: Trinidad
Junior Member

The following code is placed in when-button-pressed trigger
=============================================================
DECLARE
	
pressed		BOOLEAN;
lov_id		LOV;
rg_name		VARCHAR2(15) := 'RG_AREA_CD';
rg_id		RECORDGROUP;
code_col	GROUPCOLUMN;
desc_col	GROUPCOLUMN;
temp_cnt	NUMBER(5) := 0;	
words		VARCHAR2(120);
errcode		NUMBER;
last_row	NUMBER;
	
BEGIN

 rg_id := Find_Group(rg_name);
 	
 IF (id_null(rg_id)) THEN

  --Create new record group
  rg_id := Create_Group(rg_name);
		
  --Add columns to record group
  code_col := Add_Group_Column(rg_id, 'Codes', NUMBER_COLUMN);
  desc_col := Add_Group_Column(rg_id, 'Description', CHAR_COLUMN, 120);
		
  --Get number of area codes in new_office table
  SELECT COUNT(DISTINCT off_area_cd)
  INTO temp_cnt
  FROM new_office
  WHERE off_area_cd IS NOT NULL;
	
  --Populate record group 
  FOR area IN 1..temp_cnt LOOP
     -- concatentate service center names
     words := area_desc(area); 
     ADD_GROUP_ROW(rg_id, area);
     SET_GROUP_NUMBER_CELL(code_col, area, area);
     SET_GROUP_CHAR_CELL(desc_col, area, words);
 
  END LOOP;
		
  lov_id := FIND_LOV('LOV_AREA_FR');					  -- find LOV id created at design time
  SET_LOV_PROPERTY(lov_id, GROUP_NAME, 'RG_AREA_CD');
  pressed := SHOW_LOV(lov_id);	 -- display LOV 

 END IF;
 	
EXCEPTION
  WHEN NO_DATA_FOUND THEN
    MESSAGE('No area codes exists!');

END;


Upd-mod: add code tags.

[Updated on: Wed, 26 October 2005 18:20] by Moderator

Report message to a moderator

Re: LOV does not display [message #144499 is a reply to message #144421] Wed, 26 October 2005 18:22 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Why are you building this stuff? Can't you design it at build time and then just use it?

David
Re: LOV does not display [message #144503 is a reply to message #144499] Wed, 26 October 2005 18:40 Go to previous messageGo to next message
tornup
Messages: 13
Registered: February 2005
Location: Trinidad
Junior Member

The query is not a simple query. I need to concatenate office names that belong to certain areas, and display them in a LOV.
Example, I need this:
1 A,B,C
2 E,F,G,H

But data is stored in the table as:

1 A
1 B
1 C
...etc

I found a way out, by creating a function to concatenate and a view, running that at the back end. That works fine, but I still want to figure out why the LOV isn't working. Any help will be appreciated.
Re: LOV does not display [message #144517 is a reply to message #144503] Wed, 26 October 2005 19:47 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Because the LOV works on a one-to-one basis. You have the list of single values, the user presses the key / selects the code and you store the number value that is associated with it.

Having:
"1 - A, B, C"
"2 - D, E, F"
will not give you a '2' if you press 'E'. 'E' will give no result. You would have to double click on the 'D, E, F' line and most users don't want to use the mouse for this type of data entry.

Have you defined the 'return fields' for your LOV?

By the way, I can't see the code to concatenate the codes in your supplied code.

David
Re: LOV does not display [message #144607 is a reply to message #144517] Thu, 27 October 2005 07:06 Go to previous messageGo to next message
tornup
Messages: 13
Registered: February 2005
Location: Trinidad
Junior Member

Hi David,
I don't think I explained myself properly. I need an LOV that has 2 columns, one with area codes (1,2,3 etc) and one with office names. Since each area consists of more than one office name, I need to concatenate the office names where area = 1 or 2 etc. The area code will be used in processing data in the form. The office names are just for display purposes.

I understand what you are saying about users not wanting to use the mouse, but this is what they have requested.

The concatenation function works fine (see below)

I have defined the return fields. The strange thing is, I am not getting any errors. When I click on the LOV button, nothing is happening.

================================================================
FUNCTION area_desc(temp_area_cd NUMBER)RETURN VARCHAR2 IS

 CURSOR n IS
  SELECT DISTINCT (off_name) office_name
  FROM new_office
  WHERE off_area_cd = temp_area_cd
  ORDER BY off_name;

temp_cnt    NUMBER(5) := 0;
temp_offnames  VARCHAR2(200) := '';

BEGIN
 -- Get number of office names returned by cursor n
 SELECT COUNT(off_name)
 INTO temp_cnt
 FROM new_office
 WHERE off_area_cd = temp_area_cd;

 -- Concatentate office names into single string
 FOR offname IN n LOOP
   IF (n%ROWCOUNT < temp_cnt) THEN
     temp_offnames := temp_offnames||offname.office_name||', ';
   ELSE
    temp_offnames := temp_offnames||offname.office_name;
    EXIT;
   END IF;
 END LOOP;

 -- Display string
 RETURN(temp_offnames);
END;

Re: LOV does not display [message #144701 is a reply to message #144607] Thu, 27 October 2005 13:24 Go to previous messageGo to next message
sachinjainonweb
Messages: 24
Registered: October 2005
Junior Member
hI
As per Forms Documentation
"Each LOV must be based on a record group. A record group can be populated by a query (query record group) or by fixed values (static record group). "
What you are trying to do is to populate a LOV through third type of record group i.e. non-query record group. So thats why u r getting no LOV. Hope this might be of any help Smile

Luck Always
Re: LOV does not display [message #144728 is a reply to message #144607] Thu, 27 October 2005 19:29 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
In you when-button-pressed trigger you have all the code inside the IF 'positive' logic. Have a look at the documentation for create_group and delete_group. I expect that you need to delete the group and then recreate it. But hey, I don't do things this way.

Why not design a record_group in Forms Builder based on:
select distinct area, area_desc(area)
  from new_office
 order by 1;
then base your LOV on this record group.

David

[Updated on: Thu, 27 October 2005 19:30]

Report message to a moderator

Re: LOV does not display [message #144800 is a reply to message #144728] Fri, 28 October 2005 07:17 Go to previous messageGo to next message
tornup
Messages: 13
Registered: February 2005
Location: Trinidad
Junior Member

Hi,
I tried creating the record group this way, but I can't call the function from there, unless I run the script at the back end. I also tried deleting the group before I re-create it...but still nothing. Sigh...
Thanks for your suggestions though...
Re: LOV does not display [message #144990 is a reply to message #144800] Sun, 30 October 2005 21:44 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Put your function into the database and if necessary add a PRAGMA to make it legal.

David
Previous Topic: problem while inserting in forms 10g
Next Topic: Mirror form item
Goto Forum:
  


Current Time: Fri Sep 20 03:48:35 CDT 2024