Home » Developer & Programmer » Forms » list item populate with a query but cannot select the values
icon5.gif  list item populate with a query but cannot select the values [message #145473] Thu, 03 November 2005 06:42 Go to next message
itfreak
Messages: 7
Registered: November 2005
Junior Member
hi,

i am using Forms [32 Bit] Version 9.0.2.9.0 (Production)
Personal Oracle9i Release 9.2.0.1.0 - Production.

i have searched a lot for a solution for this problem and am posting my topic after a lot of failures.there are similar problems discussed in other topics but none is of any use.

i have 2 tables TOPIC,ARTICLE

TOPIC fields

TOPIC_ID NOT NULL VARCHAR2(15)
TOPIC_NAME NOT NULL VARCHAR2(100)
SUBJECT_CODE NOT NULL VARCHAR2(15)

Article Fields

ARTICLE_ID NOT NULL NUMBER
ARTICLE_DESC NOT NULL VARCHAR2(500)
CONTENT NOT NULL LONG
AUTHOR NOT NULL VARCHAR2(100)
ARTICLE_DATE NOT NULL DATE
TOPIC_ID NOT NULL VARCHAR2(15)

i am creating a form on the ARTICLE table with a poplist on the topic_id field.i want to populate the topic_id field in the form with the values in the topic_id fiels in the TOPIC table.i am doing this cause the topic_id field is compulsory in the form.

i created a trigger WHEN-NEW-ITEM-INSTANCE with the following code

DECLARE
group_name varchar2(40) :='LIST26';
group_id RecordGroup;
list_id Item := Find_Item('ARTICLE.LIST26');
status NUMBER;

BEGIN


group_id := Create_Group_From_Query('LIST26','select topic_ID,topic_ID from topic');
Clear_List(list_id);
status := Populate_Group('LIST26');
Populate_List(list_id,group_id);


END;


-----NOTE list26 is the name of the list in the form---

when i run the form the poplist is displayed with no values when i click the down arrow in the poplist i can see the values from the topic_id field in the TOPIC table but when i select a value i get an error

FRM-40202: Field must be entered.

and the value is not selected.

can anyone give me a solution.

on some research i think the problem is with the Mapping other values in the property pallette of the list item.but i could not figure out what value to specify there.

the help section says this

Leave this property blank to indicate that other values are not allowed for this item or radio group. Any queried record that contains a value other than the user-defined element value is silently rejected. Any attempt to assign an other value is disallowed.
Any value you specify must evaluate to one of the following references: the value associated with one of the list elements or radio groups the name (not the label) of one of the list elements

dont really know whether this is the problem or something else.

pls give me a solution


Re: list item populate with a query but cannot select the values [message #145586 is a reply to message #145473] Fri, 04 November 2005 00:11 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Does it work the first time but not the second time?

All the examples test to see if the group exists and if it does they do a 'delete' before doing the 'create'. Try that.

David
Re: list item populate with a query but cannot select the values [message #145588 is a reply to message #145586] Fri, 04 November 2005 00:19 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have a look at http://www.orafaq.com/forum/m/145587/67467/#msg_145587

David
Re: list item populate with a query but cannot select the values [message #145612 is a reply to message #145588] Fri, 04 November 2005 03:26 Go to previous messageGo to next message
itfreak
Messages: 7
Registered: November 2005
Junior Member
could you explain how i can use it in my example.

i have not understood this line of code

rg_id := Create_group_from_query(rg_name,
'SELECT SAL-MOD(SAL,1000) BASE_SAL_RANGE,' || 'COUNT(EMPNO) EMPS_IN_RANGE ' || 'FROM EMP ' || 'GROUP BY SAL-MOD(SAL,1000) ' || 'ORDER BY 1');

what r the fields and how can i apply this to my example?
Re: list item populate with a query but cannot select the values [message #145726 is a reply to message #145612] Sat, 05 November 2005 06:53 Go to previous messageGo to next message
Shaila.Mehra
Messages: 88
Registered: July 2005
Location: mumbai
Member

Hi,
Itfreak, could you tell me why you used "Clear_List(list_id)"
functions here.
well try this coding.....
DECLARE
  group_name  VARCHAR2(40) := 'LIST26';
   group_id    recordgroup;
   status      NUMBER;
BEGIN
  group_id := Find_item(group_name);
  
  IF Id_null(group_id) THEN
    group_id := Create_group_from_query(group_name,
                                        'select topic_ID,topic_ID from topic');
  END IF;
  
  status := Populate_group(group_id);
  
  Populate_list('group_name',
                group_id);
END;
Shaila Mehra.

Upd-mod: Add code tabs

[Updated on: Sun, 06 November 2005 19:37] by Moderator

Report message to a moderator

Re: list item populate with a query but cannot select the values [message #145757 is a reply to message #145726] Sun, 06 November 2005 04:56 Go to previous messageGo to next message
itfreak
Messages: 7
Registered: November 2005
Junior Member
i get the following error when i use he code

Block:WHEN-NEW-INSTANCE(ARTICLE),2 Errors
error 382 at line 7,column 12
expression is of wrong type
error 0 at line 7,column
statement ignored
Re: list item populate with a query but cannot select the values [message #145760 is a reply to message #145757] Sun, 06 November 2005 07:38 Go to previous messageGo to next message
Shaila.Mehra
Messages: 88
Registered: July 2005
Location: mumbai
Member

First try this:
Use this code at Form level trigger 'when-new-form-instance'.

Shaila.
Re: list item populate with a query but cannot select the values [message #145761 is a reply to message #145760] Sun, 06 November 2005 07:55 Go to previous messageGo to next message
itfreak
Messages: 7
Registered: November 2005
Junior Member
i get the same error at the form level trigger
Re: list item populate with a query but cannot select the values [message #145792 is a reply to message #145612] Sun, 06 November 2005 19:39 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
That is a sample line of code. What I was trying to show was that the sample code in the Reference Manual is the best place from which to start when you want to write 'interesting' code. The query is just a simple two column select.

I STILL suggest that you test for the existance of the group so that you can populate it YOUR way when you recreate it.

David
Re: list item populate with a query but cannot select the values [message #145886 is a reply to message #145473] Mon, 07 November 2005 08:16 Go to previous messageGo to next message
itfreak
Messages: 7
Registered: November 2005
Junior Member
i am able to populate the list with the following code

DECLARE
group_name varchar2(40) :='LIST26';
group_id RecordGroup;
list_id Item := Find_Item('ARTICLE.LIST26');
status NUMBER;

BEGIN

IF Id_null(group_id) THEN
group_id := Create_Group_From_Query('LIST26','select topic_ID,topic_ID from topic');
END IF;

Clear_List(list_id);
status := Populate_Group('LIST26');
Populate_List(list_id,group_id);


END;

the list is displayed in the form

but i cannot select any value from this list

what do you think is the problem?

Re: list item populate with a query but cannot select the values [message #145955 is a reply to message #145886] Mon, 07 November 2005 19:37 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Does the field have update and insert set on?

David
Re: list item populate with a query but cannot select the values [message #146056 is a reply to message #145955] Tue, 08 November 2005 06:23 Go to previous messageGo to next message
itfreak
Messages: 7
Registered: November 2005
Junior Member
yes it does have update and insert set on it
Re: list item populate with a query but cannot select the values [message #146140 is a reply to message #146056] Tue, 08 November 2005 20:39 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Do you have insert and update turned on at the block level, and 'query only' turned off?

David
Re: list item populate with a query but cannot select the values [message #146404 is a reply to message #146140] Thu, 10 November 2005 04:10 Go to previous message
itfreak
Messages: 7
Registered: November 2005
Junior Member
thanx everyone.i tried the suggesstion by david and it worked.

special thanx to david
Previous Topic: default_where
Next Topic: Forms 9i
Goto Forum:
  


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