How to change a filter to its “inverse”
Suppose you’ve written a filter to show all collisions resulting from vehicles traveling in opposite directions. (i.e. east vs west or north vs south) Now suppose you want to get all the other crashes.
Suppose you’ve created this filter to identify crashes by opposing vehicles:
How can you get all the crashes that do not fit this filter?
To get the opposite results from a filter, simply check for it to equal false:
(@Setmatch(Veh_1_Direction,Veh_2_Direction,North,South))) = false
Note the extra set of parentheses added to group the entire expression.
This new filter will capture all the crashes that the original one did not. That is, all the crashes where the vehicles were not coming from opposite directions.
Note: To make this filter “generic” so that it will work with any configuration, change it to look like this:
@SetMatch( @Veh1Dir, @Veh2Dir, @North, @South ) |
Creating the filter like this makes use of the “DrawData” configuration file to “normalize” the vehicle directions. For most configurations, this means that North-East and North-West will be converted to North, and South-East and South-West will be converted to South.
For more information on this, refer to the manual’s Filter chapter. See the section on Filter functions / Schematic functions.