Friday, July 12, 2013

PeopleCode: When Does Related Display Code Fire?

If you have a grid that has a Display Control field, along with a Related Display field, when will the component processor signal to the database to fetch the Related Display field values?



Answer: When the component processor sees that all the key values are satisfied for the Related Display record.

In trying to use the DESCR field ACCT_TYPT_TBL_SF, I noticed in my trace that at first the Related Display SELECT statements were firing on page activate, right after this code:
/* Set default value for SETID so that account type descriptions display correctly. */Y_MFC_SPMT_WK.SETID.Value = "XXX";
The solution? I moved the above two lines of code into the Component Pre-Build event.  Then, since the SETID key value was being satisfied much sooner, the component buffer knew much sooner that it could martial all the SELECT statements in the component pre-build.  Almost as if by magic ;-) this is exactly what my PeopleCode/SQL trace showed.

No comments: