I have described how to populate parent table's date inside child table in my previous post. Same way we can access child data in parent table.
Open EmpDeptFkLink view link accessor and click edit accssors icon on the top right corner of accessors scction.
Change source accessor name and destination accessor name.
Generate View Row class for DepartmentsView and generate accessor methods also ( here Emp is my child accessor name and getEmp() is the accessor method in DepartmentsViewRowImpl.java).
Then run BC tester.
Environment : Jdeveloper 11.1.1.6.0
Database : Oracle XE
Download : Link
Create model project form XE schema.
Open EmpDeptFkLink view link accessor and click edit accssors icon on the top right corner of accessors scction.
Change source accessor name and destination accessor name.
Generate View Row class for DepartmentsView and generate accessor methods also ( here Emp is my child accessor name and getEmp() is the accessor method in DepartmentsViewRowImpl.java).
Create java method for accessing child data.
public String getAllSalaries() {
RowIterator rItr = getEmp();
StringBuilder sb = new StringBuilder();
while (rItr.hasNext()) {
Row row = rItr.next();
String sal =
(row.getAttribute("Salary") != null) ? ((Number)row.getAttribute("Salary")).stringValue().trim() :
null;
if ((sb.length() > 0) && (sal != null)) {
sb.append(", ");
}
sb.append(sal);
}
return sb.toString();
}
Create a transient attribute called Salaries in Departments view object. Give default value as adf.object.allSalaries ( Grovy expression for accessing our custom method from View Row class ). adf.object points DepartmentsViewRowImpl object.
Then run BC tester.
Environment : Jdeveloper 11.1.1.6.0
Database : Oracle XE
Download : Link
No comments:
Post a Comment