Subject: Form By Employee
HI Eric,
I would think you would have to first lookup the current user’s department when the open the form.
So, if you have a view by employee name, you would have a computed for display field, i.e. Lookup_Department, that does something like this:
Dept:=@dbLookup(“”:“NoCache”;server:file;View;@username;DeptColumn);
@if(@isError(Dept) | Dept=“”;“”;Dept)
Then you would have a field below the Lookup_Department that would return the list of employees for that department, i.e. EMP_BY_DEPARTMENT_LIST. Computed for Display, multivalue field.
It would need logic - so if the LOOKUP_DEPARTMENT value is null, it returns the full employee list, else if the LOOKUP_DEPARTMENT has a value, it proceeds to lookup to a view whose first column is sorted by DEPARTMENT.
NewList:=@if(LOOKUP_DEPARTMENT = “”; @Trim(@Unique(@DBColumn(“”;“”;“EmployeeListView”;1)));
@dbLookup(“”;“”;“EmployeesbyDepartment”;LOOKUP_DEPARTMENT;2);
@if(@isError(NewList)|NewList=“”;“No employees found”;NewList);
Where the second column is the list of employee names.
Then you first field combobox can us the formula: EMP_BY_DEPARTMENT_LIST
The two fields need to be at the top of the form so they process first when the form is opened.
This will slow down the amount of time it will take for the form to open, and you will need to consider if the 150 employee list will ever grow beyond the DBLookup or DBColumn value limits.
Does this help?
Marilyn