Login
Register

Home

Trainings

Fusion Blog

EBS Blog

Authors

CONTACT US

Kishore Ryali
  • Register

Oracle Gold Partners, our very popular training packages, training schedule is listed here
Designed by Five Star Rated Oracle Press Authors & Oracle ACE's.

webinar new

Search Courses

This is continuation from APEX Search Page Tutorial where I implemented OAF Person Details Tutorial 01 in Oracle Application Express.

Objective: Implement "Delete Person" functionality as in OA Framework Tutorial 02.



Implementation Steps:

A brief overview of steps followed:

  • Add a NULL report column 'DEL_ICON' for "Delete Icon".
  • Define a hidden page item 'P1_DEL_PERSON_ID' to capture selected person id.
  • Define column link with image and parameters

Upload deleteicon_enabled.gif in Shared Components > Images (Under Files section).
Go to column attributes for DEL_ICON. Change column link attributes as shown in below screenshot.

Link Text: [img src="#WORKSPACE_IMAGES#deleteicon_enabled.gif" alt="Delete"/] . P.S: Replace '[' with '' before using the img tag. The website is treating it as image if I didnot doctor the img tag.
Target: Page in this Application
Page: 1
Item1: P1_DEL_PERSON_ID
Value: #PERSON_ID#

 

  • Create 'On Load - Before Header' page process with below PL/SQL to delete selected person.

Declare
Cursor c_del is select person_id from xx_person_details
where person_id = :P1_DEL_PERSON_ID;
l_person_id NUMBER;
Begin
Open c_del;
Fetch c_del into l_person_id;
If c_del%FOUND Then
-- Delete Person
delete from xx_person_details where person_id = :p1_del_person_id;
commit;
apex_application.g_print_success_message := 'Person Deleted';
End If;
Close c_del;
End;

  • Set Condition Type of page process to when P1_DEL_PERSON_ID is NOT NULL as shown below.

 

 

Video:

The video demonstrations follow above implementation steps. 

Video for adding Delete icon to report (6:55 min).

Video for implementing Delete procedure (9:35 min).

Screenshot of Person Details apex application after delete functionality is implemented. My application can be accessed using the url http://apex.oracle.com/pls/apex/f?p=a2fperson:1

 

 

Why did we add NULL column in report query? Can't we define computation column or a placeholder like in Oracle Reports or Discoverer?
As the report is generated of the SQL query, we cannot use computation column like in other reporting tools without modifying the query. We can also set same column link attributes to PERSON_ID rather than adding a new NULL column.

What is #WORKSPACE_IMAGES#?
It is a built-in substitution string. APEX engine replaces it with location where uploaded images, JavaScripts (JS) and CSS specific to a workspace are found.

How is #WORKSPACE_IMAGES# different from #APP_IMAGES#?
#WORKSPACE_IMAGES# is used to reference uploaded images, JS, and CSS that are shared over many applications within a workspace.

#APP_IMAGES# is used to reference uploaded images, JS, and CSS that are specific to given application.

Try it yourself .... upload the above delete icon by not selecting application in Shared Components > Images and you use [img src="#APP_IMAGES#deleteicon_enabled.gif" alt="Delete"/] for column link text. Run the page and see what happens. P.S: Replace '[' with '' before using the img tag. The website is treating it as image if I didnot doctor the img tag.


URL shows P1_DEL_PERSON_ID parameter. User can edit the URL and delete the persons without clicking on Delete Icon. Are there better ways to implement Delete?
There are definitely more sleek ways to do it. Just a few food for thoughts:

  • Enable 'Session State Protection' for application and set page access protection to 'Arguments must have checksum' to prevent user for tampering URL.
  • Use JavaScript to copy value of selected Person Id to P1_DEL_PERSON_ID rather setting parameters in Column Link which shows up in URL.
  • Use AJAX request i.e. htmldb_get function to call application process which deletes person record. This does not repaint the whole page.


I save these for later articles.


Packaged Application for Delete functionality:

My Packaged applications are created using APEX 3.2 version, you can only import them into APEX with same version. This packaged application has supporting objects i.e. table and sample data, along with apex application. You can import and run it without going through the above steps.

Download Tutorial 02 Packaged Application

Video for deploying packaged application (2:41 min). This video is applicable for deploying packaged applications for my next articles as well.

The zip has sql files for application (apex_tut02_app.sql) and image (apex_tut02_img.sql). For deploying image, select file type as 'Image Export' as shown in below image.

 

The next article I will implement Create and Update Person functionality as in OA Framework Tutorial 03 and Tutorial 04.


Kishore Ryali

Comments   

0 #1 Lokeswaran K 2009-04-17 07:22
Hi RK,

How are you doing..?

One moer general question here, is Oracle Application Express an advanced version of OAF, is Oracle applciation Express going to replace OAF by oracle?
I think its really easier and quick to develop pages here than we do it by OAF.

Thanks
Abdul
Quote
0 #2 Kishore Ryali 2009-04-17 10:51
Abdul,
I'm going well. Thanks

APEX and OAF are totally different. ADF not APEX going replacing OAF in Fusion Middleware or new versions of EBS. APEX is evolving as a superior RAD tool, which has integration with EBS and wen services. Most Oracle developers are embracing APEX because it is easy to learn and yet powerful.

Kish ore
Quote
0 #3 Hassan Shoaib 2009-04-26 14:04
HI Kishore,

First of all thanks for APEX kickstart articles they have definitely help me alot as I am new to APEX.
I have one question for which I want your suggestion.
I have requirement to capture where if I would be coming from some page say 'page23' then page 2 items should be displayed as uneditable.

Ca n you please mention how I can cater this case in Apex.

Would be obliged for your help !!!
Thanks

Reg ards,
Hassan Shoaib
Quote
0 #4 Kishore Ryali 2009-04-27 09:59
Hi Shoaib,

Your requirement is to make page items in a page say '2' as Read-Only depending upon the page it is navigated from. Suppose parent page is '23', page 2 items are read-only. Otherwise page 2 items are editable.

The following is one way to achieving it. This applies only to page items not Tabular form columns.

1. Define Application Item say 'PARENT PAGE ID' in Shared Components > Application Items.

2. Go to page 23, in column link to page 2. Add a new item 'PARENT PAGE ID' with value as '&APP_PAGE_ID.'
Here you are setting current page id i.e. 23 to application item. So when you go to page 2, you can refer application item to get parent page id.

3. Go to page 2, in page item say 'P_STUDENT_FLAG ' Read Only section, set the below
Read Only Condition Type: Value of Item in Expression 1 = Expression 2
Expression 1: PARENT_PAGE_ID
Expression 2: 23

So if you navigate to page '2' from another page say '4', Read-Only condition is evaluated to false and the page item is editable.

Hope this answers your requirement.

K ishore
Quote
0 #5 Hassan Shoaib 2009-04-29 06:43
Hi Kishore,

Thank s.. I have implemented your suggested solution and it worked.

Thanks again for the correspondence.

Regards,
Hass an Shoaib
Quote
0 #6 John J 2009-12-17 16:54
I was able to get this to work using a test page. However, in my application I have a page with multiple regions. I've made the same changes in my application but for a specific region on this page. The application doesn't work anymore. I've noticed that the parameter passing now shows: http:// .... ::P32_LINE_ID:# LINE_ID#. For some odd reason it's not translating or replacing the #LINE_ID# with the actual value. Do you know what's going on? thanks
Quote
0 #7 Kishore Ryali 2009-12-17 17:15
John,

Please check if LINE_ID column name exists or not?

Kishore
Quote
0 #8 John J 2009-12-17 17:23
Yes, the line_id exists. It's the same query from the test page which works.
Quote
0 #9 John J 2009-12-17 18:09
What it's doing is displaying in the URL: #LINE_ID.
Quote
0 #10 John J 2009-12-17 18:43
This must be an issue because there are multiple regions and multiple page processes. There's got to be something that is clearing the cache or values during the "After Header Processes" or "After Submit" process. I'm just not sure how to fix it at this point.
Quote
0 #11 John J 2009-12-17 19:26
OK. Here's the solution. I had the line_id in the query but in the application I had the column set not to display ever. If I change it to display the application works just fine. However, I really don't want to display the column in the report output. How do I "hide" it?
Quote
0 #12 John J 2009-12-17 19:33
Ok, here's the other answer. Instead of setting the condition type to "NEVER" keep the default and set the "Display Text As" to Hidden. Now it works ...
Quote
0 #13 Kishore Ryali 2009-12-17 22:57
John,
Thanks for sharing your solution.
Kisho re
Quote
0 #14 Tasos 2010-06-24 10:32
Hi,
one thing I would like to ask is how you implemented the edit action to update records. How can I do this
without using standard reports?
Quote
0 #15 Kishore Ryali 2010-06-24 11:11
Tasos,

I used wizard to create a form as shown in this article http://apps2fusion.com/at/64-kr/392-oracle-apex-person-details-tutorial-03-create-and-update-person. 'Automated Row Fetch' process in Form page fetches data based on populated person_id field. 'Process Row' process will insert/update the record based on whether person_id is null or not.

How you navigate to Form page for insert/update drives your implementation. In my case, I navigated from standard report. If user clicks on update icon, I pass person_id to form page.

Kishore
Quote
0 #16 fouzia 2010-12-10 00:08
hi,

first thanks for this site and tutorials, i'm using apex for 1 months and i want to use checkbox in order to delete rows in report instead delete icon , but i dont knew how, should i use the same procedure with delete icon .
Quote
0 #17 Umer 2012-04-25 03:46
i tried your method , its working thanks .When I reload the page its firing the function and shows the success message even though the record was deleted long back .I tried removing the cache , its not working .

Can you suggest a solution ?
Quote
0 #18 Trong Phan 2012-06-08 12:42
Hello there,

I have a question like this: I want to create a form with some basic actions (insert, delete, update). However, I dont want to keep the default behavior of APEX. I want to customize the insert and deleted action. Like I will update a "Is_Deleted" status to "1" to mark that the record is deleted and also user name who deleted, time deleted .... How can I do this?
Quote
0 #19 Nantia 2014-06-05 12:01
Hello, I have followed the instructions of and It works perfect. Could you please now help me how can i add a warning message before delete the row? I tried in column link of Delete to add: onclick=javascr ipt:apex.confir m(htmldb_delete _message,'DELET E'); and it shows up the warning message, but the row is deleted even though I press the Cancel button of the warning message. Can you please advice me? I really appreciate your reply-answer!!
Quote
0 #20 Saquib Azmal 2015-10-07 13:44
Hi Kishore,

I have a requirement in Tree Query where i need to display the node text in color ,but when i am using HTML tag ,the tag code is displaying as complete,as this Tree has do not have the option of standard report column.Can you please guide how to implement this.

Thanks,
Saquib
Quote

Add comment


Security code
Refresh

Search Trainings

Fully verifiable testimonials

Apps2Fusion - Event List

<<  Apr 2024  >>
 Mon  Tue  Wed  Thu  Fri  Sat  Sun 
  1  2  3  4  5  6  7
  8  91011121314
15161718192021
22232425262728
2930     

Enquire For Training

Fusion Training Packages

Get Email Updates


Powered by Google FeedBurner