Home » Developer & Programmer » Forms » how to display values in list item from a querry?
how to display values in list item from a querry? [message #142745] Mon, 17 October 2005 09:01 Go to next message
sangs
Messages: 8
Registered: October 2005
Location: India
Junior Member

Hi,
I need to fetch datas from the database using a querry & display it through LIST ITEM (combo box).

How do I do that in forms 6i? What should I set in the property palette? Or should i hv to write trigger for this? pls guide me.

Thank u,
Re: how to display values in list item from a querry? [message #142750 is a reply to message #142745] Mon, 17 October 2005 09:19 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
You need to create a record group at run time using
create_group (or)
create_group_from_query

After that you need to populate the list using
populate_list_with_query (or)
populate_list

The query should select two columns. One is actual value and the second one is Display value.

Don't forget to assign some dummy value to list at design time.
You have to clear the list at run time using clear_list built-in.


By,
Vamsi.
Re: how to display values in list item from a querry? [message #142885 is a reply to message #142745] Tue, 18 October 2005 02:50 Go to previous messageGo to next message
sangs
Messages: 8
Registered: October 2005
Location: India
Junior Member

hi,
Thank u for the reply....
Well as per ur advice, I created a record group at run time using "create_group_from_query" and populated
and populated the list using "populate_list"

.........this is the trigger part..........

DECLARE
group_id RecordGroup;
list_id Item := Find_Item('LIST_ITEM1');
status NUMBER;

BEGIN

group_id := Create_Group_From_Query('Answer_List','select lov1.ANSWER_LIST, lov1.ANSWER_LIST from lov1');
status := Populate_Group('Answer_List');
Populate_List(list_id,group_id);

END;

----------these are the property setting---------
Name : LIST_ITEM1
Item Type : List Item
List Style : Combo or pop list
Elements in list : ( created dummy value)

---------------------------------------------------
But after I run the form & during execution I'cldnt get the list of values from the database in the list item. It says..."Unable to perform querry"
I suspect it to be a trigger problem.
In which trigger am I to write the above codings if its correct?
Now I hv written it in "WHEN NEW RECORD INSTANCE".

My requirement is when the form is executed, it should display a list of answers(list item)for a particular question(display item)


Re: how to display values in list item from a querry? [message #142888 is a reply to message #142885] Tue, 18 October 2005 03:09 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Hi,
Is lov1.ANSWER_LIST varchar2 column?
If not put TO_CHAR() in the select statement.

put clear_list before populate_list.
Hope this should work.

As I understand, for each record the values are same in the list. So you can put that in when-new-form-instance.

Debug the status (return value of populate_group) also.

By
Vamsi.
Re: how to display values in list item from a querry? [message #142900 is a reply to message #142888] Tue, 18 October 2005 05:30 Go to previous messageGo to next message
sangs
Messages: 8
Registered: October 2005
Location: India
Junior Member

Hi,
I hv done all that u have asked me to do..& ofcourse its a varchar column.
But i dont know how to return the values in this procedure...????

----

DECLARE
group_id RecordGroup;
list_id Item := Find_Item('LIST_ITEM1');
status NUMBER;

BEGIN

group_id := Create_Group_From_Query('Answer_List','select lov1.ANSWER_LIST, lov1.ANSWER_LIST from lov1');
status := Populate_Group('Answer_List');
Clear_List(list_id);
Populate_List(list_id,group_id);
return (status);
END;

------Compilation error.------------
In a procedure, Return statement cannot contain an expression.

Wat do I do?
rgs sangs
Re: how to display values in list item from a querry? [message #142903 is a reply to message #142900] Tue, 18 October 2005 05:39 Go to previous message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Sorry! You misunderstood my suggestion regarding status value.

I want to tell you that, if you get error display the status value.

By,
Vamsi.
Previous Topic: restrict LOV in multi-user environment?
Next Topic: Forms 9i Calendar problem (insert behaviour?)
Goto Forum:
  


Current Time: Fri Sep 20 03:52:44 CDT 2024