Rule Syntax

After selecting Configure Allocation Rules on the Delivery Manager Setup menu, go down to Add Scoring Rules(s).

Basic components

Each new rule is made up of the following basic components:

  1. The Rule type, which is the first field that needs to be selected and determines what is displayed for the other drop-down menus:

    Rule_Type.png
  2. The From date starting from which the rule is to be come into effect (or leave blank for the rule to come into effect immediately).

  3. The To date on which the rule is to cease (or leave blank for the rule to apply indefinitely).

  4. The carrier service to which the rule applies. The default is any service or carrier, but, using the the drop-down menu, you can specify that the rule is to apply to a particular carrier or service, or else to any service in a particular carrier 'service group' (e.g. any service in the 48 Hours group).

  5. The warehouse to which the rule applies (the default is any warehouse).

  6. The information in the rule-dependent drop-downs, which is covered below.

Weighting rules

These are the most common types of rule, and each one is typically used to exclude a carrier service where a particular condition applies. The components for a weighting rule (over and above the Basic components) are as follows:

  1. Scoring type. For any Weighting type rule, you need to specify how it is to be scored. The default Weighting is Exclude, which means that meeting the conditions of the rule will set the carrier service to -1 and thereby exclude the service. However, if the system property operation.mode.scoring.advanced is set, then the Advanced Scoring Modes are available, which then means that all the following Scoring types types are also available, which allow the score for a carrier service to be adjusted upwards or downwards from the default baseline of 1.0:

    1. Strongly Discourage (score 10)

    2. Discourage (score 2)

    3. Softly discourage (score 1.1)

    4. Softly encourage (score 0.9)

    5. Encourage (score 0.5)

    6. Strongly encourage (score 0.1)

    7. Attempt to force (score 0, which means that the service is most likely to be used for allocation if the associated conditions are met).

    Note

    The closer to zero a score is, the more likely the associated carrier service is to be used for allocation. You can specify your own exact score for a carrier service if you use the 'Custom' rule type.

    Except for where a score is -1 (which immediately rules a service out of consideration, and no further processing takes place), scores are cumulative. This means that a delivery option receives an initial score, which can then be added to, subtracted, multiplied and divided, based on each subsequent rule. For example, if a carrier is discouraged from being allocated consignments of a certain weight, and, say, is given a score of 2.0, then the score can be adjusted downwards if the carrier is able to deliver within the next 48 hours (so, the score might come down to 1.1).

  2. The condition that must be met in order for the Scoring type to be applied (e.g. Exclude the service if the shipping cost is more than 100). The fields used to define the condition are dependent on the Rule type:

    1. Weighting by <number field> (weights & measures). You select one of the following as the number field: Shipping cost, Consignment weight, Parcel count, Maximum parcel value, Insurance value, Weight of the heaviest parcel, Maximum parcel dimension, or Consignment value. Then specify whether the condition for the number field is for it to be more than, less than, or equal to, the custom value at the end of the condition (default 100).

    2. Weighting by <text field> (names, addresses & codes). You select one of the following as the text field: Order number, Collection postcode, Delivery postcode or Custom. Then specify whether the condition for the text field is for it to be equal to, not equal to, start with, end with, or contain, the custom text string at the end of the condition.

    3. Weighting by <flags> (POD, fragile, etc.). You simply select one of the following as the consignment-level condition that must be met in order for the Scoring type to be applied:

      1. If any kind of proof of delivery is required.

      2. If the consignment contains fragile items.

      3. If The consignment contains no fragile items.

      4. If the consignment contains hazardous items.

      5. If the consignment contains no hazardous items.

      6. If the consignment contains liquid items.

      7. If the consignment contains no liquid items.

      8. If the consignment is palletised.

      9. If the consignment is not palletised.

      10. If the consignment requires a two-man service.

      11. If the consignment does not require a two-man service.

    4. Weighting by <time of day> (cut-off, collection times). You select one of the following as the time: Current time at the origin, Current time at the destination, Earliest collection time, Latest collection time, Earliest delivery time, Latest delivery time, or Order cut-off time. Then specify whether the condition for the time is for it to be after, before, or equal to, the custom time at the end of the condition.

    5. Weighting by <period of time> (between cut-offs, transit times, earliest collections, etc.). You select one of the following as the period of time: Time until cut-off, Time until despatch, Maximum time in transit, Time until earliest possible delivery, or Time until guaranteed delivery. Then specify whether the condition for the period of time is for it to be more than, less than, or equal to, the custom number of hours, days, calendar days, or weeks.

    6. Weighting by <day of the week> (weekdays, weekends, etc.). You select either collection day or delivery day, and then specify that the condition is for it to be on a specified day of the week (Monday to Sunday), at the weekend, or on any weekday.

    7. Weighting by international/domestic or by country. You simply select the consignment destination as the condition that must be met in order for the Scoring type to be applied. This can be a specific individual country or one of the following general geographical areas: the same country as the country of origin, a country within the same trading block as the country of origin, a different country from the country of origin, or a country outside the trading block of the country of origin.

Engine type factor and basic weighting

This rule type allows you to apply a custom factor (including 0 or -1) to any of the following: cost, consignment weight, cost per kilo, or fixed unit. This allows you to increase or decrease the score applied to the associated carrier service. For example, you can apply a factor or 2.0 or 3.0 to make a service less likely to be selected for allocation, in a similar way to the discourage scoring type.

Despatch limits for services <by number>

This rule type allows you to limit the associated carrier service so that either the service itself, or the associated carrier, can deliver no more than a custom number (default 100) of parcels, consignments or kilograms per day.

'Custom' rule type

Selecting 'custom' as the rule type allows you to enter the conditions/tests and scores directly, using our expression language.

Tip

Before using 'custom' rule types, it is advisable to use the Export button in the top right hand corner of the Scoring Rules page, to export the rules created via the other rule types. When you open the resultant CSV file, you will see that the exported rules contain the test and score expressions that form part of the 'custom' rule syntax. As well as providing a valuable backup, this will help you in writing your own custom rules.

Note

It is beyond the scope of this section to cover the syntax of the expression language, but custom rule examples are provided that should give you an idea of how to start creating your own rules.

The final step in creating your rule

Once you have created a rule, don't forget to click Add rule(s) at the bottom of the Add Scoring Rule(s) dialog. This saves the rule at the top of the Scoring Rules page.