Hide employee in drop down if on holiday

Hide employee in drop down if on holiday

Hi,

I have a booking schedule which has an employee dropdown to assign the job to an employee. I also have a date required (date) field on the booking form.

The drop-down Lookup fetches from Employees.
The Employees form has an Employee Holiday subform within.

I'm looking to perform the following, however, I'm stumped!

1) Look at the date required
2) Look at the employee holiday dates 
3) If the employee has a holiday date booked off on the same day as date required, do not show the employee in the drop-down employee selection list.

This is what I have, below:

  1. if(input.primary_requirement != null || input.primary_requirement.tostring() != "")
  2. {
  3. // Date Required
  4. DateReq = input.diary_date_required;
  5. //
  6. // Put logic here?
  7. //
  8. // Fetch employees that are active
  9. Employee = Employees[ID != 0 && system_status == "Active"] sort by combined_name;
  10. input.diary_tog_employee:ui.add(Employee.combined_name.getall());
  11. }

Any help will be really appreciated.

Many thanks