Navigation:  MCL Reference > Data Collection Assistant Functions >

RaceVar( )

Print this Topic Previous pageReturn to chapter overviewNext page

The function stores the result of an MCL expression under a name. We call the name a race variable. When you use the function RaceVar(cVariableName,"eMCLExpr") in a row of a view of a race, the system will see if the variable has already been defined in this race. If the variable has already been defined, the function will return the value stored in the variable. Otherwise it will evaluate the expression eMCLExpr and store the result into the variable (the variable will automatically be created) and return the result. Please note the following points about a race variable:

1.The value of a race variable of a race is independent of the same variable for another race in the same view. The expression eMCLExpr will be evaluated once for each race.
2.When you expend a view to show the past records, although the lines are not showing the data of the current race, the race variable will not be recalculated.
3.Whenever the formula for a view column contains a RaceVar( ) function, the system will automatically set the column as "No Caching" (figure below) so that values in the view data cache (particularly those put into the past records of an expanded view) will be refreshed in other races.



4.The values of race variables are store in a variable cache that will not be refreshed when you push the "Recalc" key. To refresh the variable cache, you have to hold down the Shift key when you click on the "Recalc" key.
5.Start Variables (saved and accessed via RaceVar( )) and Race Variables (saved and accessed via StartVar( )) are store in different area of the variable cache. They will not interference with each other even the same variable name is given to both a Race Variable and a Start Variable.






Data type returned by the expression eMCLExpr



RaceVar('AvgAge','RunnersAVG("HrAge( )")')

The function puts the average age of the current starters into the race variable AvgAge. Functions in all view lines can then get access to this value.

The structure of example view in the following figure is as follows:





(Built-in column)



(Built-in column)


Avg Age (Cur Race)

RaceVar('AvgAge','RunnersAVG("HrAge( )")')


Avg Age

RunnersAVG("HrAge( )")


Age Diff from Cur Race Avg

HrAge( )-Column('Avg Age (Cur Race)')


Age Diff from Avg

HrAge( )-Column('Avg Age')


In the view of the above figure, the numbers in the columns "Avg Age (Cur Race)" and "Avg Age" are the same. However, the MCL function in the "Avg Age" column will be recalculated in every row while the MCL function inside the RaceVar( ) function of the "Avg Age (Cur Race)" column will only be calculated only in the first row. Therefore, the speed of showing the latter column is much faster.

When the view is expanded to show the past records as show in the following figure, the numbers in the past records of the "Avg Age (Cur Race)" column are got from the variable AvgAge without recalculation. Therefore these figures are different from those in the "Avg Age" column.



See also

StartVar( )



Page url: