---
title: "Filters and Sharing"
canonical: "https://servicedesk.maxgeo.com/space/DS/1716092929/Filters%20and%20Sharing"
format: markdown
---
**Filters – how they are saved and shared**

In DataShed5, filters can be defined and saved either for personal use or shared with other users.

But what is happening in the SQL back-end to support this ability to share filters, isn’t always clear.  


**Cascade Filters versus normal Filters**

When you create a filter in the Cascade Filters menu **or** from the Collar/Site Grid Views, these filters are seen as Cascade filters because they define a selection based on the Collar or Site PARENT record and the filter cascades down to all CHILD tables that are linked to that parent.

Such filters will be available in both the Cascade Filter menu and also the Collar/Site grid views.

When you create a filter on a child table such as filtering on Lith1Code on tblDHLithology, this is NOT a Cascade filter as it is defined on one particular CHILD table and cannot be applied to any other table. i.e. It can’t filter tblDHMetaData on Lith1Code as the table doesn’t contain that column.  


**Unshared filters**

Both normal Filters and Cascade Filters can be shared or simply saved for personal use by the user who created them. See the Example 1 below.

When you create a new filter and do not share it, the filter is saved as a record in tblSYSFilter and saved against the User ID who created it. 

(The UserID is a numeric value assigned by DataShed to authorized users and is used in various areas such as Intercept Calculator where the results of running a package are also saved against a particular user.)

In Example 1 below we can see two filters which have not been shared. The first is a Cascade Filter because it’s defined on the Collar table. Note the last column where the Filter_CascadeTypeId has been set to 1 by the system.

	1 – Collar

	2 – Linear

	3 – Face

	4 – Point

	5 - Contracts

	6 – WAMEX Drillholes

	7 – WAMEX Points

The second filter is just a normal filter defined on the DH Lithology table and has a Filter_CascadeTypeId value of Null.

Is_Active changes depending on whether the user has the filter active or not. This is how DataShed remembers to apply filters which you had turned on in previous sessions and why you have to Disable them manually.

Both filters are assigned to User 8300 and would only be visible and available to that User.  


**Shared filters**

Example 2 below shows how Shared filters are saved.

Not only is the record created against the UserId who created it, but the record is also copied and assigned to UserId = 0 which becomes the master or template for this filter.

A hash # is added to the front of the shared filter’s name, both the personal record and the master/template record.

However, the personal filter and its master/template have unique FilterID values.  


**What happens when you copy a shared filter**

As the creator of a filter, when you come back and use the filter, it is the one with YOUR userID (8300) that is being set Active or Inactive, NEVER the UserID 0 master/template.

If you use a shared filter created by someone else for the first time, the system also duplicates the filter record under YOUR UserID and again, that is the one that gets turned on and off.

The template is never Activated. It really acts only as a template which can be copied for other users.

As the creator of the shared filter, if I edit the filter, then both the master/template and the personal versions are edited and saved.

As a user of a shared filter created by someone else:

- I can apply the filter in which case it gets copied as a new record with my UserId
- I can’t edit the filter initially. Not until I’ve applied it, and the new record is created. But as soon as it’s been applied once, I can edit/delete it.
- Now, if I edit the filter, only the personal version is edited and the Creators template is left as originally made.
- And if I delete the filter, only the personal version is deleted.


Only the filter creator can delete the master/template version of the filter. In this case, all personal versions will be deleted also.

**User Role Actions**

| **User Type** | **Create Shared Filters** | **Apply Shared Filters** | **Edit Own Shared Filters** | **Edit Master Shared Filter** | **Edit Shared Filters of Other Users** | **Delete Own Shared Filters** | **Delete Master Shared Filter** | **Delete All Shared Filters - Other Users** |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| User | :cross_mark: | :check_mark: | :cross_mark: | :cross_mark: | :cross_mark: | :cross_mark: | :cross_mark: | :cross_mark: |
| UserPlus | :check_mark: | :check_mark: | :check_mark: | :cross_mark: | :cross_mark: | :check_mark: | :cross_mark: | :cross_mark: |
| SysAdmin | :check_mark: | :check_mark: | :check_mark: | :cross_mark: | :cross_mark: | :check_mark: | :cross_mark: | :cross_mark: |
| UserPlus Creator | :check_mark: | :check_mark: | :check_mark: | :check_mark: | :check_mark: | :check_mark: | :check_mark: | :check_mark: |
| SysAdmin Creator | :check_mark: | :check_mark: | :check_mark: | :check_mark: | :check_mark: | :check_mark: | :check_mark: | :check_mark: |

**Example 1 – Unshared Filters (tblSYSFilter)**

|  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| <span style="color: #000000">FilterID</span> | <span style="color: #000000">Filter_</span>  
<span style="color: #000000">Userid</span> | <span style="color: #000000">Filter_Type</span> | <span style="color: #000000">Filter_Name</span> | <span style="color: #000000">Filter_Definition</span> | <span style="color: #000000">Filter_UserName</span> | <span style="color: #000000">Filter_</span>  
<span style="color: #000000">Advanced</span><br><span style="color: #000000">Filter</span> | <span style="color: #000000">Filter_Use</span><br><span style="color: #000000">Distinct</span> | <span style="color: #000000">Is_</span><br><span style="color: #000000">Active</span> | <span style="color: #000000">Filter_DefinitionSQL</span> | <span style="color: #000000">Filter_</span>  
<span style="color: #000000">Cascade</span><br><span style="color: #000000">TypeId</span> |
| <span style="color: #000000">9539</span> | <span style="color: #000000">8300</span> | <span style="color: #000000">tblDHColl</span> | <span style="color: #000000">Casc_Hole_ID_MGH-003_Unshared</span> | <span style="color: #000000"> ((tblDHColl.[Hole_ID] = 'MGH-003') ) </span> | <span style="color: #000000">DH Collars</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000"> (tblDHColl.[Hole_ID] = 'MGH-003' ) </span> | <span style="color: #000000">1</span> |
| <span style="color: #000000">9542</span> | <span style="color: #000000">8300</span> | <span style="color: #000000">tblDHLithology</span> | <span style="color: #000000">LithCode_AC_Unshared</span> | <span style="color: #000000"> ((tblDHLithology.[Lith1_Code] = 'AC') ) </span> | <span style="color: #000000">DH Lithology</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000"> (tblDHLithology.[Lith1_Code] = 'AC' ) </span> | <span style="color: #000000">NULL</span> |

**Example 2 – Shared Filters (tblSYSFilter)**

|  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| <span style="color: #000000">FilterID</span> | <span style="color: #000000">Filter_</span>  
<span style="color: #000000">Userid</span> | <span style="color: #000000">Filter_Type</span> | <span style="color: #000000">Filter_Name</span> | <span style="color: #000000">Filter_Definition</span> | <span style="color: #000000">Filter_UserName</span> | <span style="color: #000000">Filter_</span>  
<span style="color: #000000">Advanced</span>  
<span style="color: #000000">Filter</span> | <span style="color: #000000">Filter_Use</span>  
<span style="color: #000000">Distinct</span> | <span style="color: #000000">Is_</span>  
<span style="color: #000000">Active</span> | <span style="color: #000000">Filter_DefinitionSQL</span> | <span style="color: #000000">Filter_</span>  
<span style="color: #000000">Cascade</span>  
<span style="color: #000000">TypeId</span> |
| <span style="color: #000000">9540</span> | <span style="color: #000000">8300</span> | <span style="color: #000000">tblDHColl</span> | <span style="color: #000000">#Casc_Hole_ID_MGH-007_Shared</span> | <span style="color: #000000"> ((tblDHColl.[Hole_ID] = 'MGH-007') ) </span> | <span style="color: #000000">DH Collars</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000"> (tblDHColl.[Hole_ID] = 'MGH-007' ) </span> | <span style="color: #000000">1</span> |
| <span style="color: #000000">9541</span> | <span style="color: #000000">0</span> | <span style="color: #000000">tblDHColl</span> | <span style="color: #000000">#Casc_Hole_ID_MGH-007_Shared</span> | <span style="color: #000000"> ((tblDHColl.[Hole_ID] = 'MGH-007') ) </span> | <span style="color: #000000">DH Collars</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000"> (tblDHColl.[Hole_ID] = 'MGH-007' ) </span> | <span style="color: #000000">1</span> |
| <span style="color: #000000">9543</span> | <span style="color: #000000">8300</span> | <span style="color: #000000">tblDHLithology</span> | <span style="color: #000000">#LithCode_CL_Shared</span> | <span style="color: #000000"> ((tblDHLithology.[Lith1_Code] = 'CL') ) </span> | <span style="color: #000000">DH Lithology</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000">1</span> | <span style="color: #000000"> (tblDHLithology.[Lith1_Code] = 'CL' ) </span> | <span style="color: #000000">NULL</span> |
| <span style="color: #000000">9544</span> | <span style="color: #000000">0</span> | <span style="color: #000000">tblDHLithology</span> | <span style="color: #000000">#LithCode_CL_Shared</span> | <span style="color: #000000"> ((tblDHLithology.[Lith1_Code] = 'CL') ) </span> | <span style="color: #000000">DH Lithology</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000">0</span> | <span style="color: #000000"> (tblDHLithology.[Lith1_Code] = 'CL' ) </span> | <span style="color: #000000">NULL</span> |