?
Solved

Populate a list item with data stored in a table

Posted on 2004-08-28
5
Medium Priority
?
2,892 Views
Last Modified: 2010-05-18
Hi,

I have a form (created using the "book" table) which has a list item(poplist) called "year_book".
I have created a table "year_list" with only one column "year_book". In this "year_list" i have inserted years from 1900-2000.
At this point i want to populate the "year_book" list item(poplist) from the "book" form, using the table "year_list".

Can anyone help me??

Thank you in advance,
 krisz
0
Comment
Question by:krisztina1981
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:annamalai77
ID: 11928663
my dear friend,

u cannot populate year details from a detail, when u have a list item.
for ur condition, u should go a List Of Values only.

regards
annamalai
0
 

Accepted Solution

by:
djbaliotti earned 200 total points
ID: 11931894
Krisz,
What version of Oracle Forms are you using?  Are you running in client-server or webforms mode?  The code belows worked in client-server versions and I am pretty sure it would work in a webform too.

A list item expects two values - the display value and the actual value.  In your case they are the same (for example, 1990 and 1990).  You should be able to create a record group(rg_years) that reads "year_book" twice (Select year_book YEAR_DISPLAY, year_book YEAR_VALUE from yearlist order by YEAR_DISPLAY).  The format has to match what the list item is expecting.

You then create a List Item(poplist) and set it with some default value - it will get replaced at runtime.  I usually use a default value that would alert me that the record group has failed at runtime - like X when X is not allowed so that the form does not allow the person to enter bad data. Your error handling should catch that but seeing

At Runtime, in the WHEN_NEW_FORM_INSTANCE trigger, the following code would execute:
-- gets rid of the bogus default value
   Clear_List('poplist');
-- populates the record group.  the return code will be zero if it is successful.  You can add your -- own error checking to handle it when it is not zero
   RG_RETURN_CODE := Populate_Group('rg_years'');
-- puts the record group values into the poplist
   POPULATE_LIST('poplist','rg_year');

You can get more information from the HELP in your Oracle Forms Builder software.

You can also use a List of Values (as annamalai suggested) but you will not get the list item drop down effect, if that is required by your user.

I hope I understood your problem correctly.

Good luck,
dj
 
0
 

Author Comment

by:krisztina1981
ID: 11976829
Hi Dj,

Sorry for my late response but i couldn't answer earlier. Thanks for your detailed answer, but I have a problem with a line of the sample code:  RG_RETURN_CODE := Populate_Group('rg_years''); it tells me that i have to declare the identifier RG_RETURN_CODE. I don't know what to do. :(

Can you help me one more time? :)
I'm using oracle forms 6i, in client-server.

Thanks,

Krisz
0
 

Expert Comment

by:djbaliotti
ID: 11977605
Krisz,

You just have to declare it like this at the top of the trigger:

DECLARE
   RG_RETURN_CODE   Number;

You can use it after the function call to check how successful the Populate_group was - the Populate_Group help screen in Forms says that 0 is good and other values are actual Oracle Error values.  Since we have a generic On Error trigger to trap all errors and log them to a table, I don't bother doing the error handling here but you may want to for your application.

Hope this does it for you.

DJ

0
 

Author Comment

by:krisztina1981
ID: 11986334
Hi DJ

It's working now :).
Thanks again for your answer, it really helped me.

Thanks,

krisz
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question