0

In recent version of Oracle APEX, I would like to fetch data from CUSTOMER table then set the data into the form field.

There is an edit button in Interactive Report table. When I click this button, enter image description here

This form field will pop up.

enter image description here

Since this is an edit form, I want to retrieve the data corresponding to the ID from the customer table. In Dynamic action for this edit button, I set it like this

enter image description here

It only sets Customer ID in the edit customer form. This is the tableenter image description here

Is there a way to set all the value from the selected row?

2 Answers 2

2

Yes, in fact you do not even have to write extra logic. On your form page, you just need to

  1. add a process before-headers, pre-processing of the type Form - Initialization. Set the form region to your form.

  2. Set the primary key of form, which is Customer ID. This is the key the process will use to identify which record it is.

  3. On your other page (where the IR table lives), navigate to the IR region, attributes then Link. Set this to Link to Custom Target. In the target, make sure you pass the ID from your report to form page under Set Items.

--

UPDATED ANSWER

Since you want to add your own links, instead of using the built-in Link under your IR region,

  1. navigate to your columns instead and set these columns as Links. Do the same with setting the targets and passing the ID from your report to form page under Set Items.

Similar to the following (below, I selected the column of the report)

Here is a working example: https://gebqqvpozhjbqbs-apexsandboxabe.adb.us-phoenix-1.oraclecloudapps.com/ords/r/devbox/sandbox/demo-edit

enter image description here

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

8 Comments

I tried your logic, but the thing is, I added the edit button by adding extra clumns in SQL QUery like IR -> Source -> SQL Query -> select CUSTOMER_ID, NAME, ADDRESS, WEBSITE, CONTACT, 'Edit' Edit, 'Delete' Del from CUSTOMERS What I want to do is to click the edit button and populate the customer info.
Thank you for posting the updated answer. I understand the logic, but my EDIT CUSTOMER page is actually not a page, but dialog/popup. So when I set Page to 3 (page 3 is the customer list page, and the popup is linked to EDIT button), then I click the edit button, the page refreshes forever
Hm.. refreshing forever does not seem like normal behavior, I would suggest opening a new question with the problem. The type of page (whether it is a modal or normal page) should not affect anything. Check your pre-processes. I would check if there are any other logic that refreshes. Here is a working example. gebqqvpozhjbqbs-apexsandboxabe.adb.us-phoenix-1.oraclecloudapps…
Your sample demo app is exactly what I want to do. I commented out some of my processes and found out that when I comment out Set Value action in EDIT_ROW (Dynamic action for clicking the edit icon), it behaves differently.
Yes, in my example (demo app) no Dynamic Actions are required. These are all links passing the ID to another page. The page (whether it is a modal or a normal page) runs the process initialization process of the form based on the ID passed. You just need the things above, comment out the rest that tries to set IDs or something else
|
1

What you described is a built-in functionality.

I suggest you use the Wizard and create combination of Interactive Report with Form; wizard will guide you through the process of creating both pages. Once it is done, run the report.

When you click on the "Edit" button, Apex will navigate you from the Interactive Report to Form page, passing primary key value (you chose during the creation process), and Form's process will automatically fetch all column values and display them in page items.

As I said: automatically. You don't have to write a single line of code. Nothing.


If you want to fix it in your current form, I still suggest you do as I described. Then compare what Apex does with your own IR + Form combination. Find the differences and try to make your attempt work as it is supposed to.

2 Comments

I tried this way but the edit button is displayed on the left. I would like to put an edit button and a delete button on the right side
In that case, modify Interactive Reports "Attributes" (so that you'd "remove" default link button) and create your own. I suggest you use APEX_PAGE.GET_URL function to create URL; enclose it into HTML tags to display it as a button. Say if you need assistance with that.

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.