One of the recurrent requests from customers is to filter documents stored in DocuWare in order to avoid that users from one area or department could have access to documents from another area.

There are different approaches to face this request, the simple way is create a file cabinet for each department and then assign the respective file cabinet profiles to respective users however this could be hard to manage.

The alternative that DocuWare has provided to implement smarter configurations is the well-known, file cabinet profile with index filter so the multiple file cabinets scenario becomes in a single file cabinet with several file cabinet profiles using index filter.

But even using this approach, the administration of this structure could be something tangled, fortunately there is a possible configuration that consist of a single file cabinet and a single file cabinet profile with index filter, all you have to do is create a group for each area of your organization and use a filter for your file cabinet profile with a free SQL query and such query looks like the following:

[AREA_GROUP] IN (SELECT name FROM dwsystem.dwgroup where gid IN (SELECT gid FROM dwsystem.dwusertogroup where uid = (SELECT uid FROM dwsystem.dwuser d where name = CURRENTUSERLONGNAME() ) and gid != 1) )

In this query the variable [AREA _GROUP] is the index field that stores the area to which the document belongs, also is the name of the DocuWare group of such area, so the index values stored in the field must match with names of DocuWare groups of each area in order to guarantee the filtering, a "select list only" setting is recommended for the field.

What this does is identify the DocuWare groups to which the logged user belong and validate if any of these groups match with the stored value in the respective field.