Oracle Forms to ADF Migration
Estimation
Toggle Bar

Delete Row Code in OAF





Delete Row Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
public void deleteEmployee(String employeeNumber)
{
int empToDelete = Integer.parseInt(employeeNumber);
 
OAViewObject vo = (OAViewObject)getEmployeeSummaryVO1();
EmployeeSummaryVORowImpl row = null;
 
int fetchedRowCount = vo.getFetchedRowCount();
RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");
if (fetchedRowCount > 0)
{
deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++)
{
row = (EmployeeSummaryVORowImpl)deleteIter.getRowAtRangeIndex(i);
 
 
Number primaryKey = row.getEmployeeId();
if (primaryKey.compareTo(empToDelete) == 0)
{
// This performs the actual delete.
row.remove();
getTransaction().commit();
break; // only one possible selected row in this case
}
}
}
// Always close the iterator when you're done.
deleteIter.closeRowSetIterator();
} // end deleteEmployee

 

Create Employee Table SQL Script
Create Page Code in OAF
 

Comments 2

Divesh on Wednesday, 14 August 2019 13:48
Deleting multiple rows

Hi
If we remove the break statement from the code then it fails with Nullpointer exception with the cause deadviewrowaccessexception. Can you please help how to delete multiple rows in this logic.

Thanks

Hi If we remove the break statement from the code then it fails with Nullpointer exception with the cause deadviewrowaccessexception. Can you please help how to delete multiple rows in this logic. Thanks
Sudhakar Mani on Tuesday, 20 August 2019 13:24
Multiple Rows delete code from our OAF Beginners Guide

Hi Divesh,

From the OAF Beginners Guide..

public void deleteEmp()
{
OAViewObject vo = (OAViewObject)getEmpDetailsVO1();
EmpDetailsVORowImpl row = null;
int fetchedRowCount = vo.getFetchedRowCount();
int savedRangeSize = 0;
int savedRangeStart = 0;
if (fetchedRowCount > 0)
{
savedRangeSize = vo.getRangeSize();
savedRangeStart = vo.getRangeStart();
vo.setRangeStart(0);
vo.setRangeSize(fetchedRowCount);
setRangeStart(0);
setRangeSize(fetchedRowCount);
Row rows = vo.getAllRowsInRange();
for (int i = 0; i

Hi Divesh, From the OAF Beginners Guide.. public void deleteEmp() { OAViewObject vo = (OAViewObject)getEmpDetailsVO1(); EmpDetailsVORowImpl row = null; int fetchedRowCount = vo.getFetchedRowCount(); int savedRangeSize = 0; int savedRangeStart = 0; if (fetchedRowCount > 0) { savedRangeSize = vo.getRangeSize(); savedRangeStart = vo.getRangeStart(); vo.setRangeStart(0); vo.setRangeSize(fetchedRowCount); setRangeStart(0); setRangeSize(fetchedRowCount); Row rows = vo.getAllRowsInRange(); for (int i = 0; i
Already Registered? Login Here
Guest
Wednesday, 23 October 2019
If you'd like to register, please fill in the username, password and name fields.

Captcha Image

Login

Cron Job Starts