Home » Developer & Programmer » Forms » To create a dynamic item list in foms (10G)
To create a dynamic item list in foms [message #522539] Mon, 12 September 2011 05:16 Go to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
Hello Sir,

i have created a small table which contains only name of cities.
On form level i want to create a dynamic list of the name of these cities just by clicking on the textbox without doing any hardcoding. Can anyone help me out in doing this.

Thank you.
Re: To create a dynamic item list in foms [message #522540 is a reply to message #522539] Mon, 12 September 2011 05:23 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why not use an LOV? Alternatively see this thread
Re: To create a dynamic item list in foms [message #522541 is a reply to message #522539] Mon, 12 September 2011 05:26 Go to previous messageGo to next message
sivaora
Messages: 119
Registered: October 2009
Location: Hyderabad
Senior Member
Hi,

First change the item type to list item
and create WHEN-NEW-BLOCK-INSTANCE trigger and write the fallowing code..
declare
cursor c is select name from cities;
cnt number:= 1;
begin
for i in c loop
add_list_elements('item_name',cnt,i.name,i.name);
cnt := cnt + 1;
end loop;
end;


Regards,
Siva
Re: To create a dynamic item list in foms [message #522544 is a reply to message #522541] Mon, 12 September 2011 05:38 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
I'd put it in when-new-form-instance personally. If you've got a multi-block form you don't want that code running more than once.
Re: To create a dynamic item list in foms [message #522561 is a reply to message #522544] Mon, 12 September 2011 06:50 Go to previous messageGo to next message
sivaora
Messages: 119
Registered: October 2009
Location: Hyderabad
Senior Member
NO, create the WHEN-NEW-BLOCK-INSTANCE trigger for the particular block which you want to create dynamic list item, then it will fire only for that block.
Don't create it in form level.
Re: To create a dynamic item list in foms [message #522564 is a reply to message #522561] Mon, 12 September 2011 07:03 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Huh? What exact problem do you think will occur if the code is at form level?
Re: To create a dynamic item list in foms [message #522569 is a reply to message #522564] Mon, 12 September 2011 07:21 Go to previous messageGo to next message
sivaora
Messages: 119
Registered: October 2009
Location: Hyderabad
Senior Member
As you told, if it is created in form level it will fire morethan once for each block.
Re: To create a dynamic item list in foms [message #522580 is a reply to message #522569] Mon, 12 September 2011 08:11 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
No it won't. I'm not sure why you think otherwise.
Re: To create a dynamic item list in foms [message #522789 is a reply to message #522580] Tue, 13 September 2011 23:45 Go to previous messageGo to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
I wrote this code on WHEN-NEW-BLOCK-INSTANCE trigger

declare
cursor c is select name from cities;
cnt number:= 1;
begin
for i in c loop
add_list_elements('item_name',cnt,i.name,i.name);
cnt := cnt + 1;
end loop;
end;

but its giving error that add_list_elements should be declared.
how can i get rid of it.
Re: To create a dynamic item list in foms [message #522798 is a reply to message #522789] Wed, 14 September 2011 00:54 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Maybe because there's no such built-in? It is ADD_LIST_ELEMENT (singular, not plural - ELEMENTS).
Re: To create a dynamic item list in foms [message #522817 is a reply to message #522798] Wed, 14 September 2011 01:33 Go to previous messageGo to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
yes sir, its add_list_element.

but again i am getting FRM-30351: No list elements defined for list item.
List ITEM_NAME.
here i dont want to define elements manually in list item. It should generate dynamically in that list from database.
what can i do on this.
Re: To create a dynamic item list in foms [message #522835 is a reply to message #522817] Wed, 14 September 2011 02:11 Go to previous messageGo to next message
itech
Messages: 173
Registered: May 2008
Location: Fsd, Pakistan
Senior Member

might possible the column name "name" is keyword, so creating problem. have a try with changing the name of "name" column
Re: To create a dynamic item list in foms [message #522846 is a reply to message #522835] Wed, 14 September 2011 03:47 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Use messages to check if the query is returning data. And put the code in when-new-form-instance where it belongs. sivaora is wrong to suggest otherwise.
Re: To create a dynamic item list in foms [message #523527 is a reply to message #522846] Mon, 19 September 2011 04:08 Go to previous messageGo to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
I wrote the same code in when-new-form-instance, but again its throwing the same error (identifier 'add_list_elements' must be declared). Can you please suggest me any alternate way.
Re: To create a dynamic item list in foms [message #523528 is a reply to message #523527] Mon, 19 September 2011 04:15 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Are you seriously telling us you can't work out why you're getting that error?
When Littlefoot already told you?
And you fixed it?

Re: To create a dynamic item list in foms [message #523529 is a reply to message #522798] Mon, 19 September 2011 04:16 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
?
Littlefoot wrote on Wed, 14 September 2011 07:54
Maybe because there's no such built-in? It is ADD_LIST_ELEMENT (singular, not plural - ELEMENTS).

Re: To create a dynamic item list in foms [message #523536 is a reply to message #523529] Mon, 19 September 2011 04:50 Go to previous messageGo to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
I tried that too sir using elements/element but yet giving same error Sad
Re: To create a dynamic item list in foms [message #523537 is a reply to message #523536] Mon, 19 September 2011 04:52 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
I don't believe you.
You may be getting a different error.
Post a screenshot showing the error message.
Re: To create a dynamic item list in foms [message #523549 is a reply to message #523537] Mon, 19 September 2011 05:44 Go to previous messageGo to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
I wrote this code for generating dynamic list


declare
cursor c is select city_name from cities;
cnt number:= 1;
begin
for i in c loop
add_list_element('city_name',cnt,i.city_name);
cnt := cnt + 1;
end loop;
end;



and when i compiled i got error as : wrong number or types of arguments in call to 'ADD LIST ELEMENT'
Re: To create a dynamic item list in foms [message #523550 is a reply to message #523549] Mon, 19 September 2011 05:47 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
ADD_LIST_ELEMENT expects 4 arguments - you provided 3. Read the documentation.
Re: To create a dynamic item list in foms [message #523553 is a reply to message #523550] Mon, 19 September 2011 05:51 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
And you were passing 4 arguments before. You need to pay more attention to what you are doing.
Re: To create a dynamic item list in foms [message #523563 is a reply to message #523553] Mon, 19 September 2011 06:13 Go to previous messageGo to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
Extremely sorry sir. I oversighted it. I rectified my mistake and now its getting compiled properly without any errors.
But during run time, the elements in list are not populating. Its giving: Invalid record group for list population.
Do i have to make a record group manualy for this?
Re: To create a dynamic item list in foms [message #523567 is a reply to message #523563] Mon, 19 September 2011 06:46 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
You're getting FRM-41334 now? with that code?
Are you sure that's the correct error message?
Are you sure it's add_list_element that is causing the error?

Add_list_element doesn't use record groups so I don't see how you can get that error with that code.
Re: To create a dynamic item list in foms [message #523569 is a reply to message #523567] Mon, 19 September 2011 06:52 Go to previous messageGo to next message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
Actually i just created a record group manually and because of that this error was comming. but now i deleted the record group and just ran the form with this code. Its not giving any error, but the list is not getting populated with elements.
Re: To create a dynamic item list in foms [message #523572 is a reply to message #522846] Mon, 19 September 2011 07:03 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Which brings us back to what I told you do last Wednesday:
cookiemonster wrote on Wed, 14 September 2011 09:47
Use messages to check if the query is returning data.

Re: To create a dynamic item list in foms [message #523696 is a reply to message #523572] Tue, 20 September 2011 00:05 Go to previous message
poojamunj
Messages: 64
Registered: May 2011
Location: MUMBAI
Member
Thank you so much for your co-operation sir. Finally i am done with it. Smile
Previous Topic: Forms Builder 6i - Layout Editor Crashes
Next Topic: Oracle Forms 10g on windows xp
Goto Forum:
  


Current Time: Sat Sep 07 12:58:54 CDT 2024