oracle forms

220 pts.
Tags:
Oracle development
Oracle Forms
i'm trying to withdraw data from a form and insert it into a table... i've managed to create the process linked to the creation button (and the button of course), i 've tested it (it works) but i can't figure out what to do to GET the data from the form... the form consists of 3 items textfield items and one selectlist: p2_name p2_address1 p2_address2 p2_select_city the last item (selectlist) is a drop-down menu where it takes data from a second table (cities). here's the code i used in the process: --insert into customers (name, address1, address2, city_id) --values ('petros', 'ena', 'dyo', 2) the values are random data given by me to test if it functions... my first question, is what do i write to "values" to get the data from the form (which is filled by the user)??? my second question is: how do i get the data from the selectlist item(p2_select_city)?? also, the table Cities consists of 2 columns, city (varchar) and city_id(number, pk). i want the city attribute to appear for the user to pick, but the city_id to be given when i run the process!! i hope this isn't a lot to ask... :P since i'm just getting started on oracle, any help would be appreciated!!!

Answer Wiki

Thanks. We'll let you know when a new response is added.

1) To reference the values of your items, use this notation:

<pre>:<block_name>.<item_name></pre>

For example, if your block’s name is ‘block1′, your insert statement should be like this:

<pre>insert into customers (name, address1, address2, city_id)
values (:block1.p2_name,:block1.p2_address1, :block1.p2_address2,:block1.p2_select_city);</pre>

2) Each element in a list has a value and a description. When you reference the item as above, you get the ‘value’ of the element.

There are many ways to populate a list item. One of them is using a record group, like this:

- Create a record group from a query from the Cities table. Ask for the city_id as your first colum:

<pre>select city_id, city
from Cities;</pre>

You can create the record group at design time, or at runtime using the create_Group_From_Query built-in.

To populate the list, you can use the Populate_list built-in. For example, if your record group’s name is R:

<pre>if populate_group(‘R’) = 0 then
populate_list(‘block1.p2_select_city’,’R’);
end if;</pre>

You could put this code in the when-new-form-instance trigger of the form.

Discuss This Question: 8  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • pforos
    1)if fugured out that i fotgot the ":" before the item name... it worked like this--> :p2_name 2)i'm not sure i'm following.... :( how do i create a record group? what's a record group anyway???
    220 pointsBadges:
    report
  • carlosdl
    Just a couple of questions first: You are using Oracle Developer Suite, right ? What version of developer are you using ?
    69,920 pointsBadges:
    report
  • pforos
    Oracle Database 10g Express Edition PL/SQL Release 10.2.0.1.0 CORE 10.2.0.1.0
    220 pointsBadges:
    report
  • carlosdl
    Thanks Pforos, but that is not the developer version, that are details of you Database software, and I'm not sure whether you are using Oracle Developer Suite. We need to know what software you are using to develop your form.
    69,920 pointsBadges:
    report
  • pforos
    sry... :P i'm using Oracle Application Express!!! i'm new to that stuff, so if u need something more than that you will have to guide me through....
    220 pointsBadges:
    report
  • carlosdl
    Oh, thanks. I have not used ApEx, but let me find some time to try it out, and if you have not found the answer you need, I will be glad to help.
    69,920 pointsBadges:
    report
  • pforos
    still haven't found it... :( eitherway, even if i had i'd like to listen to another idea! ;) though, i don't think there would be any difference since what i'm asking should be quite simple (i guess)...
    220 pointsBadges:
    report
  • carlosdl
    Hi Pforos. This is how you populate a select list item in APEX (using version 3.2): -You need to create a List Of Values (LOV). You can find LOVs in the "Shared components" section. You could create a dynamic LOV using an SQL query (the first column will be the value, and the second one will be the description), for example:
    select city_id, city from Cities;
    -Then at design time, you asign the new LOV to your Select List item (in the List Of Values section of its properties).
    69,920 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following