8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23ai | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
APEX Tips : Include a Button in Each Row of an Interactive Report
This article explains how to include a button into each row of an interactive report in Oracle Application Express (APEX). This borrows heavily from the method suggested by Trent Schafer, who in turn got the idea from the "Sample Database Application" packaged application.
- Report Config (Fake Column)
- Report Config (Real Column)
- Modal Dialog Config
- Remove Auto-Generated Links
Related articles.
Report Config (Fake Column)
- Click on the report region. This will be under the "Content Body" section.
- Edit the SQL to include a fake column, made up of a literal value and a column alias. For example.
'Info' AS info_link,
- Save the change. You should see
INFO_LINK
appear in the list of columns under the "Columns" node. - Click on the
INFO_LINK
column. - Set "Type" to "Link".
- Set "Heading" to the required column heading for the report.
- Under the "Link" section do the following:
- Click the "Target" button.
- Select the page you want to link to.
- Select any parameters you want to pass to the page, mapping the destination item to the source value.
- If necessary, clear the cache of the page you are calling.
- Click the "OK" button.
- Set the "Link Text" value, which will be the button text in the report. It will default to
#INFO_LINK#
, which is the alias of the column added to the query above. This will result in the button containing the literal value in that new column. You can leave this, or overwrite it with another value. - Set the "Link Attributes" to the following, to make the link look like a button.
class="t-Button t-Button--simple t-Button--hot t-Button--stretch"
- Click the "Save" button.
Report Config (Real Column)
In the previous section we added a fake column to the report query. Instead we could have used a real column, already in the query, which would allow the button text to be populated using the column value.
- Under the "Content Body" section, expand the report region node and the "Columns" node under it.
- Click on the column of interest.
- Set "Type" to "Link".
- Set "Heading" to the required column heading for the report.
- Under the "Link" section do the following:
- Click the "Target" button.
- Select the page you want to link to.
- Select any parameters you want to pass to the page, mapping the destination item to the source value.
- If necessary, clear the cache of the page you are calling.
- Click the "OK" button.
- The "Link Text" value should default to the column name, for example
#EMPNO#
, which will result in the button containing the column value as the button text. - Set the "Link Attributes" to the following, to make the link look like a button.
class="t-Button t-Button--simple t-Button--hot t-Button--stretch"
- Click the "Save" button.
Modal Dialog Config
If the link is to a modal form, and you want to refresh the original report once the modal dialog is closed, rather than refreshing the whole page, do the following. This may already be in place depending on how you generated the initial report and form.
- Click the "Dynamic Actions" tab.
- Create a new dynamic action.
- Give the dynamic action a name, like "Refresh Report".
- Check the "When" section contains the following.
- Event : Dialog Closed
- Selection Type : Region
- Region : {the name of the interactive report region}
- Under the "True" section, click on the item.
- Set the following:
- Action : Refresh
- Selection Type : Region
- Region : {the name of the interactive report region}
- Click the "Save" button.
The report region should now refresh once the modal dialog is closed, without having to refresh the whole page.
Remove Auto-Generated Links
If you originally generated the report and form, you may already have an edit link with a pen icon. If you're replacing this with one of the links described above, you will need to remove the auto-generated link.
- Expand the report region.
- Click on the "Attributes" node.
- Under the "Link" section, set the "Link Column" value to "Exclude Link Column".
- Click the "Save" button.
The auto-generated link will no longer be present.
For more information see:
Hope this helps. Regards Tim...