In the HowTo topic See performance enhanced by a stable change we learnt how to compare the performance of a horse before and after a stable change. The following example will show you how to find all the horses which win in 60 days since a stable change. Once you understand how this example works, you will be able to create more sophisticated views, for example:
•  List all the horses which have never win in its old stable, but win in 60 days after a stable change. 
•  List all horses which win when they runs in a new distance, which they have never tried before. 
View Structure
View Name: Win in New Stable
Heading 
MCL Function 
Type(Chars) 
Stat Column 
Stat Group 
Horse 
(BuiltIn Item: Horse Name) 


Yes 
Old Stable Date 
HrDate(1, [For Not ]+Same('HrStableID( )')) 
Date 


Win in 60 Days 
HHrDate( )Column('Old Stable Date')<=60 And HrFp( )=1 
Logical 


Stat Cnt 
Iif(Column('Win in 60 Days'),1,0) 
Numeric(1) 
Yes 

Column: Old Stable Date
We have already explained in detail the formula of the column "Old Stable Date". If you have any problem with the column, please study the topic See performance enhanced by a stable change.
Column: Win in 60 Days
In order to set up the criteria "win in 60 days since stable changed", we combine to logical statements with an And operator:
1.  To find if a horse wins in the underlying start, we use: HrFp( )=1 
2.  To check if the start is in 60 days since a stable change, we use: 
HHrDate( )Column('Old Stable Date')<=60
Please note that the data type of the column "Win in 60 Days" is Logical. If both conditions are satisfied, the value of the column will be True, otherwise it will be False.
Column: Stat Cnt
Since View Statistics can only be done on a Numeric column, therefore we add a column "Stat Cnt" which will be 1 if the column "Win in 60 Days" is true and 0 if the column "Win in 60 Days" is false. The function IIF( ) (immediate if) is used to do the job.
What will be Shown in for a Race
If we apply the view to race number 10 on 3rd Apr 2005, we will see the data as shown in the following picture. Here are some notes about the figures in the picture:
•  "Very Fit" won in the underlying race. The date of the race has only been 42 days since 20 Feb 2005. Therefore the criterion "win in 60 days since stable changed" is satisfied. The column "Win in 60 Days" is thus True and the column "Stat Cnt" is 1. 
•  "Mighty Hugo" has no stable change and therefore the "Old Stable Date" is Null. Calculations involving a Null value will results in Null. Therefore the column "Win in 60 Days" is null. The Null value in a logical column is shown by a grey square in the checkbox. The value of the "Stat Cnt" column will be 0. Pleas note that the IIF( ) function regards a Null condition as False. 
•  "Royal Army" lost in the race. Therefore the column "Win in 60 Days" is false and the column "Stat Cnt" is 0. 
Stat Column and Stat Groups
In order to do a View Statistics, a Stat Column must be found in the view. A Stat Column must be of a Numeric data type. RaceMate will sum up the value of the Stat Column as the statistical result. We may carry out statistics in groups. In this sample view, the column Horse is set as a Stat Group column and a horse will be a group.
Do the Statistics
To do the statistics, click on the [Stat] button at the right hand side.
The following form will appear. Select [Exclude Zero] (since we are interested in only the horses with a 1 in the "Stat Cnt" column. The following figure shows the statistical result for the period races 1638 of the season 20042005. It shows that "Very Fit" has won twice since a stable change.
If you want to show the starts of "Very Fit", double click on the name "Very Fit". The starts will be shown in a separate form. You may hold down the Ctrl key and doubleclick on a race date on the form to show the details of the Race.
Group by Stable
If we change the horse name column to stable name (by selecting the Stable Name builtin item) and redo the statistics we can compare the figures between difference stables: