Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Populate a list item with data stored in a table

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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

810 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