Another way of locating a computer is by ‘Pattern Matching’.
This location method involves location data being encoded in computer names or another accessible source.
With pattern matching Scense will be able to pinpoint a computer to the room- or even desk-level.
Because of its accuracy pattern matching will be very useful and powerful.
The pattern matching algorithm is less suitable for laptops or other mobile devices because it involves some kind of administration or registration.
For mobile devices such as laptops the IP-subnet is probably the most accurate currently.
The Pattern Matching Manager can be started from the System tab in the Scense Explorer ribbon.
The Pattern Matching Manager shows the available patterns and the order in which they are listed is the order in which they are processed.
If the first pattern does not match the workstation to a location then a subsequent pattern will be tried.
If none of the patterns match a location then the workstation is not located by the pattern matching algorithm and should be located by the Scopes and criteria on Location Objects.
The order of the patters can be changed with the up- and down buttons.
Patterns can be added, edited and removed.
All patterns must have a name and a source. By default the Pattern Source will be the %ComputerName% variable.
This implies that there is location data encoded in the computer name, which might work for some companies but less useful for others.
To ensure optimal flexibility in choosing the pattern source, Scense supports any variable as the pattern source, including query- and function variables.
Especially the function variables allow the use of any (external) data source containing location data.
E.g. there might be a database in which computer names are mapped to locations. The function variable will be able to extract the location from this database for the ‘current’ workstation.
Once the pattern source is established and produced the location data in a useful way, the pattern can be built.
Building the pattern
In the image below an example pattern is created that uses the location data encoded in the computer name to determine the room in which the computer is registered.
To do this the administrator has defined which positions correspond with the ‘Building’, ‘Floor’ and ‘Room’ levels.
In this case the Building is determined by the character on position 3.
The Floor is determined by the 2 characters starting at position 4.
And the Room is determined by the 2 characters starting at position 6.
Determining the start and length is easily done by selecting the correct positions in the test source value using the mouse or other pointing device.
There might be situations where the length of a location data element is not fixed.
Consider these ‘computer names’:
Both computer names use the same convention to encode location data, but there’s no way to determine the location using a fixed pattern because it has variable length elements.
To overcome this issue the administrator can make use of delimited patterns or a combination between fixed and delimited elements, like the example below which will successfully map the aforementioned computer names to location objects in the tree.
Because the same delimiter is used twice in the computer name the administrator must specify which exact delimiter should be considered by the algorithm.
The Room-level is now determined by the character(s) between the 1st underscore character and the 2nd one.
If a delimiter is only used once, the number indicator can be left out.
How is this location data mapped to the Scense Location Tree?
The above pattern maps the Building-Floor-Room combination which might be unique enough to eliminate the need to map more levels. So, it’s not necessary to map the entire tree.
In order to use pattern matching the corresponding levels of the location objects should have a ‘Location Code’.
This Location Code can be entered in the property page of the Location object.
Location Codes must be ‘level-unique’ this means that all sibling location objects must have a unique Location Code.
Consider the following example:
In the above example the Building-Floor-Room combination is sufficient to uniquely identify a Room location. The red number behind the Location names are the corresponding Location Codes as they are defined in the Location objects.
Remember the 2 computer names and see how the data is mapped to the Location Codes:
- WS12_5_28= Building (1), Floor (2), Room (5)= 125
- WS212_104_54= Building (2), Floor (12), Room (104)= 212104
A Location object for Room 5 on the 2nd floor of the A-Building would look like this:
This Room has Location Code (5) and the Location Codes of all parent Locations combined produce a Location Pattern (125) as shown in the image above.
So, the pattern from the computer name (125) matches the pattern from the location (125), which means that this computer can be pin-pointed to “Room 5 on the 2nd floor of the A-Building on Blaak in Rotterdam”.