While implementing one of the requirements for View Criteria, I faced an issue when there was a request to filter View Criteria Item based on user language. Well, its trivial when you want to filter choice list defined for attribute - just specify bind variable value in View Accessor. Its a bit more tricky for View Criteria Item choice list, mainly because View Criteria can't access value from VO row. This means, if we want to filter View Criteria Item choice list, we need to use Groovy language script in order to retrieve value for View Accessor bind variable. In my case it was user language. What I did - I have read Example #154 from Steve Muench blog - Not Yet Documented ADF Sample Applications, and decided to store user language in UserData map, in order to access it from View Accessor Groovy.
If you will read Steve post, you will understand there are two approaches to access from your Model data available in ViewController layer. I prefer approach when UserData is set from custom Application Module method and then it can be accessed through Groovy.
Download sample application - UserDataGroovy.zip, where LocationId choice list is filtered based on user language. When browser works with English locale, LocationId brings locations from US:
When its set with French locale, LocationId is filtered again and shows French speaking countries:
As I already mentioned, there should be always clear separation between Model and ViewController. I'm storing user language value in UserData by calling ADF Task Flow Method Call:
This Method Call is invoking Application Module custom method, where current language is stored in UserData map:
You should see, language is stored in UserData map with currentUserLanguage ID. Same ID is used to access current language from View Accessor - adf.userSession.userData.currentUserLanguage: