Complex count

Complex count

Hi guys,
I want to count all availibility for staff member filtered for specific service. I try with:

input.Avalaibility =  FormA[Day= input.Day && Staff.Availaibility in stafflist].count();

where:
Avalaibility - is a field that sum all availibility of staff in the relation STAFF=SERVICES in FORMB.
FormA - allow user to choice service for Day and Staff.
Staff - filtered field with stafflist and Staff:ui:add(stafflist)
stafflist - FormB[Service == input.Service && Status == "Active"].ID).getall();

I do something wrong because statement return 0.

Thanks in advance for any help.

Mike