?
Solved

Populate a list item with data stored in a table

Posted on 2004-08-28
5
Medium Priority
?
2,886 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Suggested Courses

801 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