BC4J Helper by Sung Im
Thoughts on how BC4J works, code samples, and other helpful techniques
        

Conditions under Which Detail VO Is Executed in DM Master-Detail

If you have a view link in the AM's data model, the detail is normally executed when the master's currency moves.

This is so that the detail will show rows related to the master.  I.e., if you have
Dept (master) and Emp (detail), moving to Dept 20 will cause Emp to execute with bind
value of 20, so that Emp will show Emp's in Dept 20.

Note, however, that the detail execution only occurs if the detail VO has a
RowSetIterator opened on it and if the master moves to a valid row.  If the detail VO
has no RSI opened on it, the detail will not execute.  Or, if the master VO's
currency moves to the slot before the first row or the slot after the last row, the
detail does not execute (for these case, the detail will empty).

Thus, in the above example, if one does

   ViewObject voDept = am.findViewObject("Dept");
   ViewObject voEmp = am.findViewObject("Emp");

   voDept.executeQuery();


voEmp will not execute since voEmp has no RSI opened on it.

If you change the above code block to the following:

   ViewObject voDept = am.findViewObject("Dept");
   ViewObject voEmp = am.findViewObject("Emp");

   voEmp.setRangeSize(-1);

   voDept.executeQuery();


voEmp will still not execute, although voEmp.setRangeSize(-1) opened the default RSI
on voEmp, since voDept.executeQuery() will position voDept to the slot before the
first row.  voEmp is empty.  However, with the following code block:

   ViewObject voDept = am.findViewObject("Dept");
   ViewObject voEmp = am.findViewObject("Emp");

   voEmp.setRangeSize(-1);

   voDept.executeQuery();
   voDept.first();


voEmp will execute at the time when you call voDept.first() because the master is now
position on a valid row and because voEmp has an RSI opened on it.



© Copyright 2004 Sung Im. Click here to send an email to the editor of this weblog.
Last update: 5/25/04; 10:30:29 AM.