Monday, February 3, 2014

Lost default values of bind variables set in ViewAccessor

Recently i ran into a situation where i had to specify a default value for bind variable in ViewAccessor  and access the value in the lookup view object. Upon analysis, I found that when i accessed the value using bind variable accessor, the value was always null but in the overridden executeQueryForCollection method i was always receiving the default value, which i had specified, in the params parameter. Needless to say i did not want to access the params object for accessing the bind value, so to fix the issue i changed the RowLevelBinds property of the view accessor to false. Note that this property should only be used if your rowset of the lookup does not change depending upon the current rows’ attribute which essentially means that if you have to fetch a bunch of data like let’s say a list of all organizations and you want to avoid re-querying of the data based on your current rows’ (the view object row where you are using the lookup) attributes you are better off by using the RowLevelBinds=false.

Doing so leads to the following benefits

a) Avoids re-querying of the database b)More important, in my case be able to access the default bind value that i had specified on the viewaccessor using bind variable accessor.


Note: At this point of time i do not know whether this is a bug or the intended behaviour that causes the default value to be discarded when using the bind variable accessor.

No comments:

Post a Comment