Named Filters in Cosmic Frog
Named Filters are an exciting new feature which allows users to create and save specific filters directly on grid views, to then be utilized seamlessly across all policies tables, scenario items and map layers. For example, if you create a filter named “DCs” in the Facilities table to capture all entries with “DC” in their designation, this Named Filter can then be applied in a policy table, providing a dynamic alternative to the traditional Group function.
Unlike Groups, named filters automatically update: adding or removing a DC record in the Facilities table will instantly reflect in the Named Filter, streamlining the workflow and eliminating the need for manual updates. Additionally, when creating Scenario Items or defining Map Layers, users can easily select Named Filters to represent specific conditions, easily previewing the data, making the process much quicker and simpler.
In this help article, how Named Filters are created will be covered first. In the sections after, we will discuss how Named Filters can be used on input tables, in scenario items, and on map layers, while the final section contains a few notes on deleting Named Filters.
Creating Named Filters
Named Filters can be set up and saved on any Cosmic Frog table: input tables, output tables, and custom tables. These tables are found in the Data module of a Cosmic Frog model:
- Click on the icon with 3 horizontal bars at the left top of Cosmic Frog to open the Module Menu.
- Click on Data to open the section that contains all the tables of the Cosmic Frog model.
- Once in the Data section, a Filter drop-down menu becomes available, the functionality of which is covered in the Help Article. When clicking on the Filter drop-down menu, users will find following filter options available to them:
A quick description of each of the options available in the Filter drop-down menu follows here, we will cover most of these in more detail in the remainder of this Help Article:
- Show Filters: clicking on this option will show the Named Filters pane on the right-hand side of the active table. If there are any saved named filters for the table, they will be listed here. If the Named Filters pane is showing (e.g. expanded), then the option in the drop-down menu changes to Hide Filters which will collapse the Named Filters pane if user chooses this option from the drop-down menu.
- Add Filter: if a filter is applied to the active table, then choosing Add Filter will save the filter and user is prompted to give the filter a name.
- Duplicate Filter: a copy of an existing filter can be made by using the Duplicate Filter option.
- Rename Filter: use this option to change the name of an existing filter, for example if user has found the current name is no longer descriptive enough.
- Delete Filter: use this option to delete the currently selected filter.
- Clear Filters from All Tables: this option will clear all filters that are currently applied to any tables, regardless of the table being open or not.
- Clear Filters from Active Table: if there are any filters applied to the active table, this option will clear those.
- Show Input Data Errors: this is a built-in filter that can be applied to input tables and will show only records which contain incorrect data. Think for example of a field containing a negative value where only positive values are valid.
Let’s walk through setting up a filter on the Facilities table that filters out records where the Facility Name ends in “DC” and save it as a named filter called “DCs”:
- The Facilities input table is open.
- Click on the filter icon to the right of the Facility Name to open the filter configuration pop-up. The filter that is applied uses the Ends with option set to “DC”.
- For the filter to take effect on the Facilities table, click on Apply.
- Now at the right top of the Facilities table there will be an indication that the table is filtered on the Facility Name field. Clicking on the crossed-out filter icon next to it will clear the filter from the table.
After setting up this filter, click on Add Filter in the Filter drop-down menu to save it:
- After clicking on Add Filter in the Filter menu, the Named Filters pane on the right of the input table opens up if it was not open already. If any filters had already been saved on the Facilities table, they would be listed here. In this case, this is the first Named Filter that is being saved for the Facilities input table.
- Type “DCs” to name the filter. After typing the name and clicking enter, it is now listed in the Named Filters pane:
- The DCs named filter is listed in the Named Filters pane and it can be turned on (i.e. applied) or turned off (i.e. cleared) by checking and unchecking the checkbox.
- Hovering over the name of a Named Filter will show information about the filter: it lists the field names of the fields that the filter applies to and for each field, it also lists what type of condition is applied to it. Here the field that the filter applies to is Facility Name. The type of condition can for example say “single condition” as is the case here (Ends with “DC”), or could say “or condition” in the case of multiple conditions to which or arguments are applied (e.g. facility region equals Texas or facility region equals Utah to filter out all facilities that are either in the state of Texas or in the state of Utah), etc.
There is a right-click context menu available for filters listed in the Named Filters pane, which allows the user to perform some of the same actions as those in the main Filter menu shown above:
- These 3 options work on the selected filter itself and can be used to duplicate, rename, or delete the Named Filter that was right clicked on.
- If a filter is applied to the input table, clicking on Add Filter will add a Named Filter for it to this list.
- The Clear Filters from All Tables and Clear Filters from Active Table options are available here too, which will achieve the same as the corresponding options in the main Filter menu.
Next, we will see how multiple Named Filters can be applied to a table. As an example, there are 4 Named Filters set up on the Facilities table in this model:
- There are 4 Named Filters set up on the Facilities table: one named DCs that filters out all records where the Facility Name ends in DC, one named Ports that filters out all records where the Facility Name ends in Port, one named Factories that filters out all records where the Facility Name ends in Factory, and one named USA locations that filters out all records where the Country is USA. This last one, USA locations, has been applied to the table.
- At the top right of the table, we also see that the USA locations Named Filter is applied to the table.
- We see that all 9 filtered out records have Country = USA.
- We see that these locations are of different types: 7 DCs, 1 Factory, and 1 Port.
Now, if we want to filter out only Ports located in the USA, we can apply 2 of the Named Filters simultaneously:
- The checkboxes of both the Ports and USA locations Named Filters are checked and therefore both are applied to the table.
- At the top right of the table, we again see that these 2 Named Filters are applied, and if desired we can clear them here by clicking on the crossed-out filter icon.
- The filter icons to the right of the field names for the Facility Name and Country fields are blue, indicating a filter is applied to both. And we can see that indeed only Ports in the USA are filtered out (there is only 1 in record that matches the filter criteria in this model).
In other words, applying multiple Named Filters to a table acts as AND statements: only records that match the criteria of all Named Filters are filtered out.
To alter an existing filter, we can change the criteria of this existing filter, and then save the resulting filter as a new Named Filter. Let’s illustrate this through an example: in a model with about 1.3k customers in the US, we have created a Named Filter “US Midwestern States”, but later on realize that we have not include the state of Michigan as 1 of the 12 Regions to include in this filter:
- We are on the Customers input table.
- A Named Filter called “US Midwestern States” is applied.
- Clicking on the blue filter icon to the right of the Region field name opens up the filter that is applied. Going through the filter we see it consists of multiple OR statements, each of which is set to “Equals” a state name of a Midwestern State. However, Michigan is not listed. In order to add it:
- Scroll to the end of the applied filter and add another OR condition for “Equals Michigan”.
- Click on Apply.
Now the US Midwestern States Named Filter with this one specific addition is applied. However, this does not update the US Midwestern States Named Filter. The table will now have the field name of Region as the indication of what type of filter is applied a the right top. Click on Add Filter in the Filter drop-down and give the Named Filter a new unique name. Naming it the same as an existing Named Filter to override it is not possible. Say we called the new Named Filter “US Midwestern States New”:
- Apply this new Named Filter.
- We can see the number of filtered rows going up to 157 (from 137), and also see customers with Region = Michigan appear in the filtered Customers table.
If the US Midwestern States filter was already used on any other tables, scenario items or map layers (see sections below on how to), then the easiest way to start using the new filter with Michigan added to it instead of it would be to 1) either delete or rename the US Midwestern States filter (for example to US Midwestern States Old), and then 2) rename the US Midwestern States New filter to US Midwestern States.
In this example, we added a condition to a field that already had multiple conditions on it. Similar steps can be used to update Named Filters where conditions are removed from fields or conditions are added to fields that do not have conditions on them yet.
So far, the only examples were of filters applied to one field in an input table. The next example shows a Named Filter called “CZ2* Space Suit demand >6k” on the Customer Demand input table:
Conditions were applied to 3 fields in the Customer Demand table, as follows: 1) Customer Name Begins With “CZ2”, 2) Product Name Contains “Space”, and 3) Quantity Greater Than “6000”. The resulting filter was saved as a Named Filter with the name “CZ2* Space Suit demand >6k” which is applied in the screenshot above. When hovering over this Named Filter, we indeed see the 3 fields and that they each have a single condition on them.
Besides being able to create Named Filters on input tables, they can also be created for output and custom tables. On output tables this can expedite the review of results after running additional scenarios where one can apply a pre-saved set of Named Filters one after the other once the runs are done instead of having to re-type each filter that shows the outputs of interest each time. This example shows a Named Filter on the Optimization Facility Summary output table to show records where the Throughput Utilization is greater than 0.8:
- We are on the Optimization Facility Summary output table.
- A Named Filter with the name “Tput Utilization > 80 percent” is applied.
- In this example this results in 4 records where the utilization was more than 80%.
The last option of Show Input Data Errors in the Filter menu creates a special filter named ERRORS and filters out records in the input table it is used on that have errors in the input data. This can be very helpful as records with input errors may have these in different fields and the types of errors may be different, so a user is not able to create 1 single filter that would capture multiple different types of errors. When this filter is applied, any record that has 1 or multiple fields with a red outline will be filtered out and shown. Hovering over the field gives a short description of the problem with the value in the field.
- The Show Input Data Errors option from the Filter menu was used while on the Products table. This special filter is called “ERRORS” and has its own red icon so it is easily recognized.
- In this case one record is shown. The Unit Price field of this records has a red outline indicating its value is troublesome. Hovering over the field it says “can not be negative”. Updating the Unit Price to a value => 0 will resolve the input data error.
Using Named Filters on Input Tables
Named Filters for certain model elements (i.e. Customers, Facilities, Suppliers, Products, Periods, Modes, Shipments, Transportation Assets, Processes, Bills Of Materials, Work Centers, and Work Resources) can be used in other input tables, very similar to how Groups work in Cosmic Frog: instead of setting up multiple records for individual elements, for example a transportation policy from A to B for each finished good, a Named Filter that filters out all finished goods on the Products table can be used to set up 1 transportation policy for these finished goods from A to B (which at run-time will be expanded into a policy for each finished good). The advantage of using Named Filters instead of Groups is that Named Filters are dynamic. If records are added to tables containing model elements and they match the conditions of any Named Filters, they are automatically added to those Named Filters. Think for example of Products with the pre-fix FG_ to indicate they are finished goods and a Named Filter “Finished Goods” that filters the Product Name on Begins With “FG_”. If a new product is added where the Product Name starts with FG_, it is automatically added to the Finished Goods Named Filter and anywhere this filter is used this new finished good is now included too. We will look at 2 examples in the next few screenshots.
- We are on the Transportation Policies input table.
- When typing 2 characters or more into a field, here the Origin Name field, a drop-down of matches from different tables, groups, and named table filters is populated. Here “Fa” has been typed in.
- There are 2 matches from the Facilities table: 2 records have a Facility Name that contains “Fa”, El Bajio Factory and Princeton Factory. Either of these can be chosen from the list to set up a transportation policy for that individual factory.
- There is 1 match from the Groups table: 1 record has a Group Name that contains “Fa” and is of a Group Type that can be used as the origin for a transportation policy (Group Types of Facilities, Suppliers and Sources can be used): the group named Factories which contains the El Bajio and Princeton factories. If this group is chosen, a transportation policy is set up for these 2 factories. If a new factory is added to the Facilities table, it will not automatically be added to the Factories group and therefore this transportation policy will not be updated to include the third factory.
- There is 1 match from the Tablefilters (= Named Filters) present in the model in tables that are suitable to function as origins in a transportation policy (the Facilities and Suppliers tables). The Named Filter is called Factories and this is a filter with a condition on the Facility Name field on the Facilities table for Ends With “Factory”. If this Named Filter is chosen, a transportation policy is set up for these 2 factories. If a new factory is added to the Facilities table and the name ends with “Factory”, it will automatically be added to this Factories Named Filter and therefore this transportation policy will also be automatically updated to include the third factory.
The completed transportation policy record uses Named Filters for the Origin Name, Destination Name, and Product Name, making this record flexible as long as the naming conventions of the factories, ports, and raw materials keep following the same rules.
- The Factories Named Filter from the Facilities table where the condition of Ends With “Factory” is applied to the Facility Name field.
- The Ports Named Filter from the Facilities table where the condition of Ends With “Port” is applied to the Facility Name field.
- The Raw Materials Named Filter from the Products table where the condition of Begins With “RM” is applied to the Product Name field.
The next example is on one of the Constraints tables, Production Constraints. On the Constraints tables, the Group Behavior fields dictate how an element name that is a Group or a Named Filter should be used. When set to Enumerate, the constraint is applied to each individual member of the group or named filter. If it is set to Aggregate, the constraint applies to all members of the group or named filter together. This Production Constraint states that at each factory a maximum amount of 150,000 units over all finished goods together can be produced:
- We are on the Production Constraints input table.
- The Facility Name is set to the Factories Named Filter from the Facilities table (condition on Facility Name for Ends With “Factory”). Since its Group Behavior field is set to Enumerate, the constraint applies to each factory of the Named Filter individually.
- The Product Name is set to the Finished Goods Named Filter on the Products table (condition on Product Name for Does not contain “RM”). Since its Group Behavior field is set to Aggregate, the constraint applies to the 3 finished goods in the model together.
- The Constraint Type and Constraint Value fields set the upper limit of 150,000 units.
Using Named Filters in Scenario Items
When setting up a scenario item, previously, the records that the scenario item’s change needed to be applied to could be set by using the Condition Builder. Now users have the added option to use 1 or multiple saved Named Filters instead, which makes it easier as the user does not need to know the syntax for building a condition, and it also makes it more flexible as Named Filters are dynamic as was discussed in the previous section. In addition, users can preview the records that the change will be made to so the chance of mistakes is reduced.
The following example changes the Suppliers table of a model which has around 70 suppliers, about half of these are in Europe and the other half in China:
- We are creating a Scenario Item named “Exclude China Suppliers” (Module Menu > Scenarios, Scenario Menu > New Item).
- We select Suppliers as the Table Name as this is the table we want to make the changes to.
- We type status = ‘Exclude’ in the Actions box since we want to change the Status of a subset of Suppliers (those located in China) from Include (which is the Status in the Suppliers table) to Exclude.
- In the Conditions section we choose to use Named Filters to set the condition(s) of which records on the Suppliers table should have their Status set to Exclude.
- Click on the down caret to open the Named Filters drop-down list.
- There are 2 Named Filters listed here from the Suppliers table. The Europe Suppliers Named Filter has a condition on the Country field of Does not contain “China” and the China Suppliers Named Filter has a condition on the Country field of Equals “China”. We choose the China Suppliers Named Filter by checking its checkbox:
The Named Filters drop-down collapses after choosing the China Suppliers Named Filter as the condition, and now we see the Preview of the filtered grid. This is the Suppliers table with the Named Filter China Suppliers applied. At the right top of the grid the name of the applied Named Filter(s) is shown, and we can see that in the preview we indeed only see Suppliers for which the Country is China. So these are the records the change (setting Status = Exclude) will be made to in scenarios that use this scenario item.
Next, we will look at an example where we apply 2 Named Filters as the condition for a scenario item:
- The scenario item that is being created is called “Incr Price Space Suits and Rockets”.
- The table the change is made to is the Products table.
- The change that is made is to multiple the Unit Price field by 1.3, in other words to increase the Unit Price by 30%.
- Again, we are using the Named Filters option to set the condition of which records in the Products table this change should be applied to.
- Without any Named Filters applied yet, we see the preview of the Products table with all records showing: the 3 finished goods which have a Unit Price specified are listed at the top by sorting the grid by Unit Price.
After clicking on the Named Filters drop-down list, we select 2 of them:
The FG Rockets and FG Space Suits Named Filters have been selected. FG Rockets only filters out Rockets from the Products table (condition of Contains “rocket” on the Product Name field) and FG Space Suits only filters out Space Suits from the Products table (condition of Contains “space” on the Product Name field). The Filter Grid Preview looks as follows after applying these 2 Named Filters:
- We are looking at the Filter Grid Preview of the Products table after applying the FG Rockets and FG Space Suits Named Filter. These are the records the change (multiplying Unit Price by 1.3) will be applied to in the scenarios that use this scenario item.
- The 2 applied filters are listed at the top right of the filtered grid preview.
- There are 2 records this change will be applied to: the record for Space Suits and the record for Rockets.
In other words, applying multiple Named Filters to a scenario item is additive (acts like OR statements): records that match the criteria of any of the Named Filters are filtered out.
A few notes on the Filter Grid Preview:
- The column(s) to which condition(s) are applied are indicated with the filter icon next to the field name(s).
- Users can resize the columns by clicking on the horizontal bars in between them and then dragging those left or right.
- Users can sort them by clicking on the field names, clicking once sorts in ascending order, clicking again in descending order, and clicking one more time takes the sort off. Sorting by multiple columns is possible too: after sorting the first column, hold down the Ctrl and Shift keys and then click on the second column to sort by, etc.
- Users cannot change the order of the columns in the grid.
Using Named Filters on Map Layers
Besides using Named Filters on other input tables and for setting up conditions for scenario items, they can also be used as conditions for Map Layers, which will be covered in this final section of this Help Article. Like for scenario items, there is also a Filter Grid Preview for Map Layers to double-check which records will be filtered out when applying the condition(s) of 1 or multiple Named Filters.
In this first example, a Named Filter on the Facilities table filters out only the Facilities that are located in the USA:
- We are on the Map named Supply Chain (Module Menu > Maps, click on the Map named Supply Chain), and are adding a new Layer named “USA Facilities” to it (Map Menu > New Layer).
- In the Layer configuration pane on the right, we are on the Condition Builder (left icon of the 3 icons at the top right).
- For Layer Name, “USA Facilities” was typed in.
- Facilities is selected as the Table Name from which the later will be generated.
- Besides the Condition Builder which was already available to users to manually type in any conditions to be applied to the Facilities table when adding the Map Layer, users now have the option to use Named Filters instead, which is the option selected in this example.
- The “USA locations” Named Filter was selected from the Named Filters drop-down list. This is a Named Filter on the Facilities table with a condition on the Country field of Equals “USA”.
- Here the Show Grid Preview option is turned on, which changes the view of the map to the Filter Grid Preview (by default it is off and the changes will be immediately visible on the map).
- Since Show Grid Preview was turned on, we see the Filter Grid Preview here.
- At the top right of the filtered preview of the Facilities table, it is indicated that a filter called “USA locations” is applied.
- In the Grid Preview itself we see that 9 locations match the filter’s condition of Country = USA, and therefore these 9 locations will be shown on this Map Layer. Switching the Show Grid Preview off, the map appears:
- We are still on the Supply Chain map.
- The USA Facilities layer was added and is the only one that is enabled for the Supply Chain map currently.
- As mentioned, the Show Grid Preview has been turned off again.
- The map shows the 9 locations that are based in the USA.
Another example of the same model is to use a different Named Filter from the Facilities table to show only Factories on the map:
- We are on the Supply Chain map still.
- A Layer named Factories is the only one that is enabled.
- Named Filters are used again as the condition.
- The Factories Named Filter on the Facilities table is used to only show the 2 factories in the model (in El Bajio and Princeton). The condition applied to the Facility Name field is Ends With “Factory”.
If the Factories and the Ports Named Filters had both been enabled, then all factories and ports would be showing on the map. So, like for scenario items, applying multiple Named Filters to a Map Layer is additive (acts like OR statements).
The same notes that were listed for the Filter Grid Preview for scenario items apply to the Filter Grid Preview for Map Layers too: columns with conditions have the filter icon on them, users can resize and (multi-)sort the columns, however, re-ordering the columns is not possible.
Notes on Deleting Named Filters
Named Filters can be deleted, and this affects other input tables, scenario items, and map layers that used the now deleted Named Filter(s) in slightly different ways. This will be explained in this final section of the Help Article on Named Filters.
A Named Filter can be deleted by using the Filter Menu’s “Delete Filter” option or by choosing that same option from the right click context menu of a Named Filter. One first important note is that user will not be asked for a confirmation after choosing the Delete Filter option, it will be deleted immediately.
The results of deleting a Named Filter that was used are as follows:
- Deleting a Named Filter that was used on another input table: the record(s) that use the Named Filter are left unaltered in the other input tables. As these are now invalid, they will be ignored during a model run.
- Deleting a Named Filter that was used as a condition in a scenario item: the Named Filter is not applied anymore, so its condition is no longer placed on the scenario item. Note that the Filter Grid Preview still shows the name of the Named Filter at the right top of the grid, but from the preview user can tell that the filter is in fact not applied anymore.
- Deleting a Named Filter that was used as a condition for a Map Layer: the Map Layer(s) where the deleted Named Filter(s) were used as a condition do not show anything on the map and the Layer will be highlighted with a red triangle and red font indicating something in the setup is wrong:
Removing the deleted Named Filter(s) from these Map Layers resolves the issues.