1

I have an oracle apex form version 24 . i have a user ID and i need to fetch his name and put it in an item on the screen . what is the proper way to do so ?

I am new to this technology.

i did try dynamic actions but it didn't work i don't know if it is the proper way to do so.

the dynamic action code

select emp_num
INTO :P3_EMP_NUM
from HR_EMPLOYEES
where EMP_ID = :P3_EMP_ID

RETURN :P3_EMP_NUM;

-- NOTE THIS WAS A PL/SQL FUNCTION BODY TYPE

2 Answers 2

1

In Apex, a form page is rarely standalone; it is usually called from an interactive report (IR) page via "Create" or "Edit" buttons:

  • in the first case ("Create"), you don't pass anything to the form
  • if you "Edit" current record, ID is being passed from IR to a form

You said that you have user ID, so I'll presume that it is the 2nd case.

If that's so, one way to do what you want is to modify ID item to be a Select List item. It uses List of Values - in your case, you'd use query, e.g.

select emp_name as display_value,
       emp_id   as return_value
from hr_employees

which then automatically displays employee name (instead of its ID). If you want to display ID as well, concatenate it to emp_name.


On the other hand, if you - for some reason - manually enter ID into the form item, create dynamic action (DA) on it so that when its value changes, a Set Value DA will populate the name item.

select emp_name 
from hr_employees
where emp_id = :P3_EMP_ID;

Make sure to put P3_EMP_ID into "Items to submit" property; affected element is item named P3_NAME.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

In APEX, data that is rendered on the page can be initialized in a couple of different ways. Forms and reports have their own source definitions - so then you could use a select list as @Littlefoot states. If that is not the case and this page item is not part of a form or a report then you could use a page process or a computation to set the item value. If the username needs to be display on every page of the application, then use an application item (not a page item) and initialize it (just once for the entire app) using an application computation or an application process.

5 Comments

Thank You. both answers are great. in my case i have a page having a drop down lov i get the user id and pass it to the other form in which i get the employee name from a separate table in the database . i guess computation is the answer to it.
do you have sources to learn oracle apex 24 ? I'm finding some difficulties in learning it.
apex.oracle.com > scroll down to "learn"
i have some experience in oracle forms 10G , i can't find a way in oracle apex to do pre insert and post insert actions ( pre insert ,post insert , pre delete , post delete , pre update , post update ) can anyone help ?
I have never worked with forms. When you post a comment to an answer as you're doing know, only me will get an alert and now one else sees this comment. In APEX I'm guessing those actions would be done in page processes at different processing points, but that is just a guess.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.