Filters are listed on the left hand side of various windows. They are used to filter the display of these windows, allowing an Administrator to quickly find and focus on only certain items.
Each record in the Programs window potentially represents an aggregate of several individual program versions. A search filter looks for satisfaction based on ANY of the individual versions within the aggregate. This can sometimes lead to confusing results.
For example, compare a [search for all programs that ARE published by Microsoft] with a [search for all programs NOT published by Microsoft]. Chances are that there exist program line items (i.e. program variants listed in the Programs window) that satisfy both searches! All it takes is a variant that includes one program version with Microsoft in the publisher field while a second program version (aggregated into the same variant) has no publisher in the publisher field.
Computer and Program filters can also have associated Rules which are applied when computers or programs are discovered (or when new information about an existing item is discovered). If you add a rule to a filter in these windows, it floats to the top of the filter list.
Filters can also be used to restrict the scope of reports. With a filter selected, right-click to see the drop down menu which includes a list of all the reports that will accept the selected filter as a restriction. For example, a program filter can be used to restrict any report that deals with programs (e.g. a report whose detail lines are programs).
Filters can be applied by clicking just to the left of the filter you wish to apply in the selected window. Doing so will change which items are displayed in the main pane. You can also double-click a filter, which will open up a new window that will display only the filtered items. This window will not have the left-hand section which the main window has. It also has a section at the top where the filter can be edited, and which can either be collapsed or expanded.
Check marks are used in each pane of the Display column (left side of the window) to activate individual Filters, Divisions, Folders, etc. A combination of check marks will select all items that match at least one check marked condition in every pane that is used for the selection (e.g. has at least one check mark). This means that when a pane is being used for selection (so it has at least one check mark), an additional check mark will generally increase the number of items displayed as a match. If an additional pane is activated for the selection (by adding a check mark to a pane that had none), then the number of items displayed as a match will generally decrease.
To make a Filter, right click in the Filters section of the left pane of any Window and choose New Filter.
There are three ways of specifying a filter:
If you click the Apply button at the top, the filter will be saved with the name you gave it, and the results will be shown in the pane at the bottom of the window.
For Computers or Programs, there is a Rule sub pane in the upper right. Once you verify the filter works using Apply, you can check off actions to turn the filter into a Rule. In the future, any computer that connects will be processed by the Rule, for example to sort into a Division according to Name.
Group membership can be specified as a selector when creating a Computer filter in the graphical interface - but the behavior may be surprising! Computers which are members of the group due to a Node, Location, or Division clause in the Group definition will be selected as expected. But a computer that is a member of the group due only to external authentication will not be included among the selected computers when using the filter! This is because authentication generally bases group membership on user name, rather than computer, and it is not terribly meaningful to check the “Last User” for group membership. Also, if a group is specified in a filter, but the group contains only filters, the filter by group will not include computers that match the filter defined in the group - since this extra level of indirection is not necessary.
The Match This Filter option allows for custom selection criteria specified using less common fields which are not included in the graphical interface. Also, it allows you to specify multiple values for the same field, or use boolean logic beyond simply the "AND" operator.
If you start out by choosing various conditions in the Match These Values section, and then change to Match This Filter, you will see a text representation of the filter you have specified. The basic format is a series of conditions in parentheses, separated by " && ". Each condition involves one field name and one constant. Here is a list of rules for writing filters.
In the filter string, you can use columns from the appropriate table, but you should drop the table prefix. e.g. instead of “computerFreeSpace”, use “FreeSpace”. Most fields will work in the filter string, but a few may not. Note that if you are using Computer Custom Columns, you should use usr0 through usr9 as the column names in any filters for custom Label 1 through 10.
Here are some complex examples:
(Platform=Macintosh)&&(osvr<0x0a0d0000)- Show all MacOS systems that are pre High Sierra.
(LastLogin<@20060315120000Z) && ((LastUser="lab user") || (LastUser="anonymous"))- selects computers which have not had someone login since 12:00:00 on March 15, 2006, and where the last user was either "lab user" or "anonymous"
(LastAudit=NULL) && (Audit=1) && (ClientVersion>=0x6008)- selects computers which are set to be audited, but have never completed an audit, where the client version is at least 18.104.22.168
(Audit=1) && (LastLogin>@20060401080000Z) && ((LastAudit=NULL) || (LastAudit<@20060101120000Z))- selects computers which are set to be audited and have logged in after 8:00 on April 1, 2006, but have either never completed an audit, or have not completed an audit since January 1st, 2006
(Platform=Windows) && (Path!="") && (!("C:"*=Path))- selects windows programs where the sample path is not empty, but the sample path doesn't start with "C:"
There are a number of special criteria that are stored in various flag values in the database. These are not specifically documented, but can be useful in many common cases. Here are some useful filter strings that may be of interest:
The standard ksp-admin installation includes an xml file, placed in "Sassafras K2/Admin/Misc/", that defines several sample filters. You may find these useful either directly or as a basis for your own further customization. To import only relevant sample filters for use in just one of KeyConfigure's list windows, simply drag the xml file, "Sample Filters.xml", and drop it onto the filters area of the window. Alternatively, the entire set of sample filters can be imported all at once by dragging the "Sample Filters.xml" file and dropping it onto the KeyConfigure program file itself. To save an xml copy the current filters defined for a particular list window, use the Export context menu item under the Filter section label. [Note: these xml files are readable as text, so you may find "Sample Filters.xml" useful to look at even without importing.]