How to Select Races

Before looking at selecting races based on class we will take a quick look at selecting races by track condition. There are two special variables to help you do this. First is GCODE which is a one character code like G for Good, S for Soft etc. You can test for it using the "contained in" ($) operator as follows:


The second special variable is GNUM which represents the numeric track condition rating (1-10 or 1-11 in NZ). You can test this is within a desired range using the special Within function as follows:


Now to selecting races by class. Selecting races based on their official class has always been tricky due the the numerous class names and abbreviations in place. System Selector's new "Expert Mode" it is certainly better suited to testing race classes as it is imposes much less restrictions on the way in which you can test the data.

We will take a look at selecting classes by their official class designation in a moment but first a reminder that Bet Selector computes its own numeric class for a race which is stored in the AVBASE variable (which can be typed in or selected from the System Selector Data drop down in the system editor).

Our Best Bet system has a rule requiring the AVBASE figure to be 56 or more and this is coded as follows:


Note the "2." at the beginning of the line to indicate to the program that this is a "race" rule that can be run before the horse and form based rules. This helps speed up system tests as explained in more detail at:

How to Write Faster Systems

If you just want to set a minimum figure for AVBASE then the above example is fine but if you want to set a maximum as well then you can use the Within function as follows:


The Within function test to see if the first argument is within the bounds of the second two arguments so the above example tests to see if AVBASE is within the range 45 to 55. If it is within the desired range then the functions returns TRUE, if not then it returns FALSE.

Now we will move on to testing the official race class designation which is stored in the variable R:RCLASS. Here is an example that selects only Benchmark races:


Note we put the class variable lats as we want to test to see if the word "Benchmark" is included in the class designation. The way to remember ow this works is that the shorter character string must always be on the left of the dollar sign (contains) operator.

And here is an example that selects only Restricted races.


If you want to select Benchmark or Restricted races then you need to use the .OR. operator as follows:


If you want to exclude Restricted races the add the .NOT. operator as follows:


If you want to exclude both Restricted and Benchmark races then this requires a little more than just putting .NOT. at the front of the earlier example. Because .NOT. has a higher precedence than .OR. you need to surround the entire rule by parentheses before adding the .NOT. as follows:


Here is an example that excludes maiden races:


If you want all Group races (I, II and II) then use the following:


If you just want to select Group I races then you can't just test to see if teh class designation includes "Group I" as "Group II" and "Group III" also contains "Group I". What you need to do is test for an exact match as follows:

2."Group I"==Alltrim(R:RCLASS)

Note the double equals (==) means "exactly equals" and should be used in place of the single equals sign which can result in "Fillies"="Fillies and Mares" returning true. Note also the use of the Alltrim() function which trims off any leading or trailing spaces (in the case of a race class it gets rid of excess spaces on the right hand end of the class which if left present would cause the exactly equals comparison to not work as expected).

If you want all Group races and all Open races then use the following:


There is another variable R:REST that contains the official race restriction (if any). For example it might be set to "Fillies" or "Fillies and Mares". With this in mind we can use the following rule to exclude Fillies races:


Note the above would also exclude "Fillies and Mares" races as this restriction includes the word "Fillies". If you only wanted to exclude "Fillies" races then you would have to do and exact match test as follows:


There is also an age restriction variable R:AGE which can be used to include or exclude races for horses of certain ages. For example to pick 2yo races use the following:


Note the above will pick any race with "2yo" in the age restriction meaning it will also pick 2yo+ races. If you want to avoid this then you could test for an exact "2yo" match as follows:


There is one more variable called R:WEIGHTS that tells us if the race is a "Handicap", "Set Weight" or "Weight For Age". Individual tests for each of these are as follows:

2."Set Weight"$R:WEIGHTS
2."Weight For Age"$R:WEIGHTS

Note both "Weight for Age" and "Set Weight" include the word "Weight" so an easy way to test for both of these together is as follows:


Whether it be class, restrictions or ages, you need to make sure you test for the correct designations. To help in this regard it is recommended that you sample meetings via "LOAD DATA TABLES" in the Price Predictor part of the program and check the actual designations in the text boxes down the left hand side of the window.

Finally a note of the last start class which is contained in the variable F:FCLASS. Following is an example on how to use this for excluding horses that raced in a Maiden race last start:


Note the above should be used in conjunction with a rule to ensure horses have at least one race start.