OracleArea51

Sponsored By Chola Global Services LLC

Copying multiple rows in an Advanced Table(OAF)

E-mail
(2 votes, average 4.50 out of 5)

Selecting multiple rows in an advanced table is a very common requirement in any project. Be it deleting rows or copying rows we need to know how to select the rows first before writing code for the functionality .So now let us see how to select multiple rows in a Advanced table.

 

Don't have an Vision instance to practice these tutorials? Visit http://cholagls.com/products-/11i-virtual-machine for details.Our smart solution to smart people like you !!

Right click on the region which you created using region wizard and select multipleSelection.

multiselect

In the table components you can see that a new item has been created called tableSelection->multipleSelection.

multi
Before setting the properties we need to create a new attribute in the VO which is being referenced in the region. A attribute called SelectFlag which will determine if the check box is being selected or not. Click multipleSelection1 and set the View Instance and View Attribute. View attribute will be SelectFlag.

Create a new method in AMImpl.java file. Add the following code:

 

 
OAViewObject vo = (OAViewObject) getAllFilesDisplayVO1();
 AllFilesDisplayVORowImpl row = null;
 String Result = "F";
 OAViewObject destvo = (OAViewObject) getFilesCopyVO1();
 Number numberVersion = null;
 Number numberFolderId = null;              
 if (!destvo.isPreparedForExecution())
 {
 destvo.setMaxFetchSize(0);
 destvo.executeQuery();             
 }                  
 try
 {
 destvo.setRowValidation(false);
 Row savedCurrentRow = vo.getCurrentRow();
 int savedRangeStart = vo.getRangeStart();             
 Row[] sourceRows = vo.getFilteredRows("SelectFlag", "Y");
 if (sourceRows != null && sourceRows.length > 0)
 { 
 int numRows = sourceRows.length;
 for (int i = 0; i < numRows; i++)
 {
 Row newRow = destvo.createRow();
 row = (AllFilesDisplayVORowImpl) sourceRows[i];
 try {
 numberVersion = new Number("1");
 numberFolderId = new Number(FolderId);
 }<
 catch (Exception exception) {
 throw OAException.wrapperException(exception);
 }
 newRow.setAttribute("FileName",(String)row.getAttribute("FileName"));
 destvo.insertRow(newRow);                                  
 }
 }
 vo.setCurrentRow(savedCurrentRow);
 vo.setRangeStart(savedRangeStart);
 }
 finally
 {
 destvo.setRowValidation(true);
 }
 Result = "S";
 return Result;           
 }

 

 

Aarthi Sudhakar
Points: 1501
Contact Author | Website :
 

Related Posts:

relatedArticles
Trackback(0)
Comments (3)add comment

jegnathan@gmail.com said:

0
Add row in table
Hi,

I have created a table and a button named "Add Row". While clicking the Add Row button i want to add a row in the table. How can i do it. Please help me.

Thanks in Advance,
Jegan
 
June 23, 2009
Votes: +0

Sudhakar Mani said:

Sudhakar Mani
...
Hi Jegan,
While clicking the Add Row button,catch the event in controller and invoke a method in AM which will be some thing like below.

import oracle.jbo.Row;
import oracle.apps.fnd.framework.OAViewObject;
//Code:

public void createEmployee()
{
OAViewObject vo = (OAViewObject)getEmployeeFullVO1();
if (!vo.isPreparedForExecution())
{
vo.executeQuery();
} 
Row row = vo.createRow();
vo.insertRow(row);
row.setNewRowState(Row.STATUS_INITIALIZED);
} // end createEmployee()

public void apply()
{
getTransaction().commit(); } // end apply()
}



 
June 24, 2009
Votes: +0

Ganesh said:

Ganesh
...
Hi,

I have a requirement like...

I am having a table and a button"Add More Rows", when I click the button it will open another page where I can search and select multiple records and click Apply button. Now I need to get the data and have to display in the table.

Once the data is populated into the table I need to save the data into the database through VO.

I am little bit confused, how to get the mutliple records through request and how to insert all the records?

Please suggest me

Thanks in Advance
 
September 29, 2009
Votes: -1

Write comment

busy