Form By Employee

Hi,I have a form with 2 fields:

Employee Name (editable Combobox) with 150 employees

Department (computed text fied) with this formula :

V := @DbLookup( “” ; “” ; “ListEmployees” ; Employee ; 4 ) ;

@If( @IsError(V ) ; “” ; v )

and Ihave a hiddenfield “Author”

Now how is it possible to filter my form by Department?

For example, I would like the “IT DEPARTMENT” see just the List of their emplyee in the fiedl “Employee Name” .

Any suggestions or existing samples please ?

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

Subject: Categorize a view by Department

Assuming you mean that each document contains the name of only one employee, then you’re done. You can optonally embed that view in a form and use a single category formula to display only one department at a time, even going so far as to do a lookup to retrieve the current user’s department first, and therefore limiting the user to only see their own department.

However, it looks as though you may mean that you have one field with multiple (150) employee names, and a second field with 150 departments? If so, then it’s still possible, but more detail is needed about exactly which names show up in which document?

Subject: RE: Categorize a view by Department

Hi,Do you have a sample or is there something in Sandbox who can help me ?

Thanks

Subject: RE: Categorize a view by Department

You never answered which of the two scenarios you have: One username in the field or 150?

Subject: RE: Categorize a view by Department

For example I have:IT DEPARTMENT:

Mr Smith

Mr Douglas

Mr steve

etc…

MAINTENANCE:

Mr ryan

Mr whattever

Subject: RE: Categorize a view by Department

That still doesn’t answer my question. I don’t know whether you were trying to represent a view displaying Employee docs categorized by department or one document containing all that data. I will ask my question yet again: Do you have one document per employee containing one employee name in one employeename field, or one document containing many emplyee names in a multivalue field?

Subject: RE: Categorize a view by Department

one document per employee containing one employee name in one employeename field

Subject: RE: Categorize a view by Department

Ok, then from your last post it looks as though you’ve already created the view I referred to in my original post that categorizes Employee documents by department, which is possibly all that you need. When you ask for a sample, what are you asking for a sample of? A single-category view? I don’t know of a sample of something so simple, although there are many examples which utilize such views, including the “Show all my posts” view of this forum. Here’s a link to a Designer help document which explains single-category views.