Follow by Email

Saturday, 4 June 2016

ADF Basics: Count number of records in LOV using LOV Accessor

Hello All

This post is about a simple requirement - How to count number of records in a LOV ?
I have seen this type of threads on OTN forum so here I am writing about it

We can make use of LOV Accessor to  count number of records in LOV as per selected source viewObject record, Here I am using Departments and Employees table of Oracle HR Schema

I have created a transient attribute in Department viewObject to show Department wise Employees LOV, To filter Employees ViewObject using Department Id  created a viewCriteria to filter it

Now applied LOV on transient attribute (Created in Departments ViewObject) and passed Department Id in Lov Accessor to filter Employees list

LOV part is done, Now to count number of records in Lov I have added one more transient attribute in Departments viewObject and used LovAccessorName.count("KeyAttributeName") to populate transient value, this expression will calculate number of records in LOV as per selected Departments record

Now dropped this viewObject as form on page and see output

Moving to Next Record-

Now suppose if you want to disable lov when there is no records in list , for this just put a condition on lov component

Cheers :) Happy Learning

No comments :

Post a Comment