我有2个以编程方式填充的View对象,即,该对象在Query Statement区域中没有SQL查询。有HeaderVO和LinesVO。我的任务是在高级表中显示高级表。而这个基于HeaderVO和LinesVO的高级表。如果我使用View Link,则HeaderVO表将显示数据,而LinesVO表仅显示“未执行搜索”。从逻辑上讲,我理解为什么会这样。
但是如何连接这2个表(查看对象)?
答案 0 :(得分:0)
随着VO以编程方式填充,您可以尝试通过以编程方式在这些VO之间创建查看链接。您可以将以下方法用于同一方法:
将主VO假定为deptVO,将细节VO假定为empVO。
// Build an attribute array, consisting of deptVO.DeptNum for Master VO
AttributeDef[] deptAttrs = new AttributeDef[1];
deptAttrs[0] = deptVO.findAttributeDef("DeptNum");
// Build an attribute array, consisting of empVO.DeptNum for Detail VO
AttributeDef[] empAttrs = new Attributedef[1];
empAttrs[0] = empVO.findAttributeDef("DeptNum");
ViewLink vl = myAM.createViewLinkBetweenViewObjects("yourVLName",
"VLAccessor", //accessor name
deptVO, //master VO
deptAttrs, //master VO attribute
empVO, //detail VO
empAttrs, //detail VO attribute
null); //association clause
答案 1 :(得分:0)
为了在OAF advancedTable组件中具有主从关系,必须正确映射详细信息VO子属性。当您以编程方式定义了主VO和子VO时,请确保已完成此步骤。您是以声明方式还是以编程方式创建advancedTable?
createViewLinkBetweenViewObjects API
ViewObject voDept = am.createViewObject("MyDeptVO", "package1.DeptView");
ViewObject voEmp = am.createViewObject("MyEmpVO", "package1.EmpView");
AttributeDef[] deptLinkAttrs = new AttributeDef[] { voDept.findAttributeDef("Deptno") };
AttributeDef[] empLinkAttrs = new AttributeDef[] { voEmp.findAttributeDef("Deptno") };
ViewLink vl = am.createViewLinkFromEntityAssocName("MyDeptEmpLink",
"Employees",
voDept, deptLinkAttrs,
voEmp, empLinkAttrs,
null);