Extensions Global filters Estimated reading: 3 minutes Global filters are advantageous for large tables with many data records to which the same filter is always applied. They are permanent filters for a table. They offer the option of modifying getgresult (= function that fetches the data) independently of rights, users, etc. Global filters are a specific rule and an extension that stands above everything else. A global filter is similar to the client capability, but easier to use. With a global filter, the filter is ALWAYS applied to the selected table and there are no exceptions where it is suspended. The global filter is valid for every user of this table. Example 1 Let’s assume a company has several locations: Munich, Paris, Vienna and Madrid.If a “Customer” table is now to be permanently filtered by location, this can be done using a global filter. Example 2 Let’s assume a company consists of several departments. If a “Orders” table should now always be permanently filtered by department, this can be done using a global filter. Create a global filter A new file with the name “ext_globalFilter.inc” must be created in the extensions. In this file, a new function can now be created for each global filter, in which the function of the global filter is defined.Possible commands are “WHERE” or “IF-THEN-ELSE” commands. A global filter can be used for several tables if the names of the attributes are the same.See also Extension for the description of the code of an extension and Extensions for all extensions in general. Example Let’s assume a company consists of several departments. If a “Customers” table is now to be permanently filtered by department, this can be done using a global filter. EXTENSIONS/ext_globalFilter.inc function globalfilter1($gtabid,&$extension){ $departmentId = 3; $extension['where'] = 'customers.department = ' . parse_db_int($deparmentId); } Apply a global filter to a table Global filters can only be applied to tables by the admin. The settings for a table can be accessed under [Admin -> Tables -> “A table group” -> gear symbol]. Fig. 1: Table settings In the table settings under [Options -> Global filter], you can select the corresponding extension as a global filter for this table. This only works if a global filter has previously been created and must be done individually for each table. Remove a global filter from a table To remove a global filter from a table, the tick must be removed under [Admin -> Tables -> “corresponding table group” -> gear symbol -> Options -> global filter]. Change a global filter A global filter can be changed by changing the corresponding function in the code under [Extensions -> ext_globalFilter.inc].