Documentation > Admin >
Custom Routing Rules
This document describes custom routing rules and ways in which they should be configured.
Township Range Section Routing
Two formats can be used for this kind of routing rules.
Separate Township / Range / Section
trs("township","range","section")
This format accepts Township/Range/Section coordinates as separate parameters.
Sample rules:
trs("11N","04E","32")
trs("10N","03E","11")
trs("10N","04E","20")
Each parameter may be defined as a range, set of values or "*" (matching all values). For example:
trs("11N","01E","\*")
The "section" will match any value.
trs("01S","34E","1,2,3,15-19,30-31")
The "section" will match the following values: 1, 2, 3, 15, 16, 17, 18, 19, 30, 31
Combined Township / Range / Section
trsSpan("town range section - town range section","city","county")
This format accepts range for township-range-section coordinates and (optionally) city and county parameters.
Sample rules:
trsSpan("T10S R18E - T9S R18E")
trsSpan("T12S R14E S31 - T12S R14E S13")
trsSpan("T8N R14W S25 - T8N R14W S13")
Section part for both range bounds may be omitted. In this case, sections from 1 to 31 will be accepted.
Those rules can also include city and county. For example:
trsSpan("T31N R21W S10 - T31N R21W S10", "Springfield", "Martin")
which will route tickets that match the TRS range and have city value of "Springfield" and county value of "Martin".
Both city and county can have a value of "*". In this case, the rule will match all values for that field. For example:
trsSpan("T31N R21W S10 - T31N R21W S10", "\*", "Martin")
…applies to all cities, but only Martin county.
Polygon Routing
Format:
polygonQMG("[latitude],[longitude];…")
This routing rule accepts a polygon defined with geographical coordinates. Each point of this polygon is represented by a latitude/longitude pair. Latitude and longitude have one of two formats:
- ddmmss format - where dd - degree, mm - minutes, ss - seconds.
- dd.ffff format - where dd - degree, ffff = minutes/60 + seconds/3600. It must be rounded to four digits.
Sample rules:
polygonQMG("310315,-813000;310315,-813200;310445,-813200;310445,-813000")
polygonQMG("310745,-813200;310745,-813445;310900,-813445;310900,-813200")
polygonQMG("360815,-795615;360815,-795630;360830,-795630;360830,-795615")
polygonQMG("36.1375,-79.9375;36.1375,-79.9417;36.1417,-79.9417;36.1417,-79.9375")
This has "QMG" in the name for historical reasons; it is used for all polygon-based routing regardless of whether the tickets use Quarter-Minute-Grid notation.
TicketRx attempts to match the latitude and longitude coordinates of the center point for each grid on the ticket, in order, until a match is found. Only the first line of QMG grids are parsed from tickets.
County Page Routing
Format:
countyPage('[county]','[pattern]')
Sample rules:
countyPage('KNOX','99O')
countyPage('KNOX','89\*')
City-County-State Routing
The standard City-County-State Routing is applied after the custom routing rules. So if necessary the city-county-state routing rules can alternately be expressed as custom routing rules. This allows the order of the rules to be defined with the custom routing rule priority field.
Format:
"[city]".equals(getCity()) && "[county]".equals(getCounty()) && "[state]".equals(getTicket().getState())
Sample rules:
"Springfield".equals(getCity())
"Springfield".equals(getCity()) && "Madison".equals(getCounty())
"Springfield".equals(getCity()) && "Madison".equals(getCounty()) && "WI".equals(getTicket().getState())
Term Routing
Format:
routeTerm("[term code]")
Sample rule:
routeTerm("M07")
Ticket Type Routing
Format:
ticketType != null && ticketType.indexOf("[ticket type]")>=0
Sample rule:
ticketType != null && ticketType.indexOf("EMER")>=0
This rule will route all tickets with ticket type containing text value "EMER".
"Type of Work" Routing
Format:
getTicket().getTypeOfWork() != null && getTicket().getTypeOfWork().indexOf("[type of work]")>=0
Sample rule:
getTicket().getTypeOfWork() != null && getTicket().getTypeOfWork().indexOf("TRENCHING")>=0
This rule will route tickets where the "type of work" field contains the value "TRENCHING".
"Work Done For" Routing
Format: "[work done for]".getTicket().getLatestTransmission().getWorkDoneFor()
Sample rule:
"AMERICAN ELECTRIC".getTicket().getLatestTransmission().getWorkDoneFor()
This rule will route tickets where the "work done for" field exactly matches "AMERICAN ELECTRIC".
Temporarily Routing Emergencies
If one of your locators is off for a day, then you may want to have their emergency tickets handled by another locator. One way to do that is the following:
From the View / Reassign Areas screen, create Areas for routing the emergency tickets. For example if you have area named Smith County then you might make a new area named Smith County - Emergencies.
From the Custom Routing Rules screen, create the new emergency routing rules. Copy each of the existing routing rules and prefix this to the beginning of the rule:
getTicket().isEmergency() &&
Make the new rules route to the new emergency areas. Set the priority of the new rules to a lower number than the old rules so the emergency rules will be applied first.
NOTE: If you select a rule and then press Create New Area then all of the fields of the current rule will be copied as the starting point for the new rule. This is a convenient way to make a copy of a rule.
With this routing rule structure then on days when a locator is not working you can have their emergency tickets handled by another locator by simply changing what user is assigned to the emergency area on the View / Reassign Areas screen.
Routing After-hour Emergencies
If you need to setup special routing rules to handle after-hour emergencies then you can do the following:
From the View / Reassign Areas screen, create Areas for routing the emergency tickets. For example you can create an area named "After-hour Emergencies". Name these areas in a way that makes sense to your users.
From the Custom Routing Rules screen, create the new after-hour emergency routing rules with this text as well as any additional routing criteria that is needed.
getTicket().isEmergency() && getTicket().getLatestTransmission().isAfterHours()
Be sure to give this new rule a lower priority number than the current rules so it will be applied before the normal routing.
Mapbook Routing
Mapbook routing is available for ticket formats that include mapbook values. The syntax for the rules is like this:
mapBook("256C11")
If the mapbook value matches 256C11 then the ticket will be routed. The comparison is case-insensitive, so this rule will also match "256c11" with a lower-case "c".
Multiple mapbook values can be routed with a single rule by putting commas between them like this:
mapBook("256C11,5158K3")
In this case if the ticket has either mapbook value then it will be routed.
If a ticket has multiple mapbook values on it, then only the first one will be used for routing purposes.
Map Location Routing
If tickets include a "map location" field then they can be routed like this:
"354K7".equalsIgnoreCase(mapLocation)
If the map location is "354K7" then the ticket will be routed.
mapLocation != null && mapLocation.startsWith("354")
If the map location starts with "354" then the ticket will be routed.
mapLocation != null && mapLocation.matches("354K[78]")
If the map location is either "354K7" or "354K8" then the ticket will be routed.