Count number of records in LOV using LOV Accessor

Sharing is Caring

Hello All
This post is about a simple requirement – How to count the number of records in LOV?
I have seen this type of threads on OTN forum so here I am writing about it can make use of LOV Accessor to count the 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 a transient attribute (Created in Departments ViewObject) and passed Department Id in Lov Accessor to filter Employees list

 

LOV part is done, Now to count the 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 the number of records in LOV as per selected Departments record

Now dropped this viewObject as a form on the page and see the output

Moving to Next Record-

Count number of records in LOV

Now suppose if you want to disable lov when there is no records in the list, for this just put a condition on lov component
disabled=“#{bindings.NoOfEmployee.inputValue==0}”

Cheers 🙂 Happy Learning

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *