Search code examples
oracle-apex

Oracle APEX - fetch data from SQL table then set them to form fields


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?


Solution

  • 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