# UK Horse Racing's Data Analyst Tool

## Functions

### Introduction

As a part of the DA Tool extra functions needed to be written so that one could find the data required. For example, one may wish to find the highest rated value in a certain field, say the One Year Class & Weight Differentials that was, for example, ten points clear of the other horses' value in the same race. If this were the case then one would use the TopColumnRatedAbsolute() which would identify that horse.

Below is a list of all of the extra functions which are available to be used along with a brief explanatory note on its use. This list of functions is always going to expand on users' requests so if you need something that's not here then please do ask.

### Function List

#### IsValue()

This returns True if the price of the run was value or False if it doesn't.

It is called as follows:
If IsValue(asEntry(), 1.0) then
The only bit which can be changed is the number 1.0; the rest of the call mustn't be changed. This is the modifier to the value; so if this is 1.0 then we're looking at the exact value price; if it's 1.3 then we're looking at 30% above value.

#### IsInPriceRange()

This returns True if the price of the run was between the two numberic values or False if it wasn't.

It is called as follows:
If IsValue(asEntry(), 2.0, 9.0) then
The only bit which can be changed are the numbers; the rest of the call mustn't be changed. The first number is the lowest allowed price and the second is the highest price permitted.

#### PoundsFromTopRated()

This returns the number of pounds which this horse was rated behind the top rated horse in the race. If this is the top rated horse then zero is returned.

It is called as follows:
If PoundsFromTopRated(asEntry(), nIndexStart, nIndexEnd) <= 12 Then
Nothing in the actual list of parameters may be altered though the value 12 at the end may be replaced with any other value.

#### IsTopJumpRated()

This function returns True or False. It returns True if this horse is the Top Rated Jump horse in the race (Chases only).

It is called as follows:
If IsTopJumpRated(asEntry(), nIndexStart, nIndexEnd) Then
Nothing in the actual list of parameters may be altered..

#### CountJumpRatedHorses()

This function returns the number of horses which have a certain jump rating (the last parameter). This applies to Chases only.

It is called as follows:
If CountJumpRatedHorses(asEntry(), nIndexStart, nIndexEnd, nChaseJumpAbility) = 1 Then
Only the last argument may be changed.

#### GetRaceGender()

This function returns the gender of horses competing in this race.

It is called as follows:
sGender = GetRaceGender(nRaceIndexStart, nRaceIndexEnd)
Nothing may be changed here. The result from the function call is one of three possible string values: "Male", "Female" or "Mixed".

#### CountRaceAlarms()

This function returns the number of any given alarm in the race. For example you may wish to search the race and cound the number of "p" alarms.

It is called as follows:
CountRaceAlarms(nIndexStart, nIndexEnd, "p")
Only the last parameter may be changed, for example it may be "+", "e" or any of the other alarms used. This may be useful, for example, if one wishes to look for races with, say, only one "+" alarm in.

#### IsInRangeAll()

This function returns True or False depending on whether all of the Columns (which should be numeric!) fall between the maximum and minimum values.

It is called as follows:
If IsInRangeAll(asEntry(), "DK,DL,DM,DN,DO,DP,DQ,DR,DS,DT,DU,DV", 1, 3) Then
Only the last three parameters may be changed. In this example above we are looking to see if the values of all of the fields DK to DV fall within the range of 1 to 3. These are the Underscore Ranking Fields, by the way. Of course, one needn't have any many fields as this but they all have to be comma seperated and be numeric fields. .

#### InRangeCount()

This function returns the number of Columns (which should be numeric!) fall between the maximum and minimum values.

It is called as follows:
If InRangeCount(asEntry(), "DK,DL,DM,DN,DO,DP,DQ,DR,DS,DT,DU,DV", 1, 3) > 3 Then
Only the last three parameters may be changed. In this example above we are looking to see if more of than three of the values of all of the fields DK to DV fall within the range of 1 to 3.

#### InRangeRacesCount()

This function returns the number of Columns (which should be numeric!) fall between the maximum and minimum values. This function differs from the InRangeCount() function in that this function counts all of the columns which are in range within the race.

It is called as follows:
If InRangeRacesCount(nIndexStart, nIndexEnd, asEntry(), "DK,DL,DM,DN,DO,DP,DQ,DR,DS,DT,DU,DV", 1, 3) > 3 Then
Only the last three parameters may be changed. In this example above we are looking to see if more of than three of the values of all of the fields DK to DV fall within the range of 1 to 3 within the whole race and not just for the one horse.

#### GetColumnRanking()

This function looks at any numeric column and then returns its ranking in terms of the race.

It is called as follows:
If GetColumnRanking(nIndexStart, nIndexEnd, nIndex, "EO") <= 3 Then
Only the last parameter may be changed and here, in this example, we're looking for the top three values of column EO in the race.

#### TopColumnRatedAbsolute()

If you need to check whether the horse was the top ranked in a particular column then this is the function to call.

It is called as follows:
If TopColumnRatedAbsolute(nIndexStart, nIndexEnd, asEntry(), "EO") > 0 Then
This function returns a positive number showing how far this horse is in this field if it has the highest value in the field. So, for example if the horse we're looking at in this example has the highest value in the "EO" (Class Differential Average) field by 12, then this would be returned as plus twelve. If the value returned is negative then it indicates how far behind the top ranked it is. This is used in the Mission-10 calculations.

#### TopColumnRatedPercentage()

If you need to check how far ahead, in percentage terms, the horse was the top ranked in a particular column then this is the function to call.

It is called as follows:
If TopColumnRatedPercentage(nIndexStart, nIndexEnd, asEntry(), "EO") > 5# Then
This function is similar to the TopColumnRatedAbsolute() but instead of returning the actual difference it returns a percentage value; positive if top ranked and negative if not. It is advised, if one is looking for the top ranked percentage in a race, for example, investigating the Mission-11s, that this is run after a call for the TopColumnRatedAbsolute() to ensure that there are no difficulties with negative or zero figures.

#### ColumnTotal()

Sometimes you may simply need to add the numbers up in a certain column for the whole race.

It is called as follows:
If ColumnTotal(nIndexStart, nIndexEnd, asEntry(), "EL") >= 20 Then
This example looks at column EL (the number of runs used in the Class Differential calculations) and asks whether the total of this column is 20 or higher. Only the last argument, the column indentifier, may be changed.