ROUND

This tutorial is specific to our newest product, Hudl Sportscode. If you’re on Sportscode v11, use these resources instead or upgrade today.

This script will return a numerical result which has been rounded to the specified number of digits from the decimal point. It will round up or down depending on which is the closest digit.

FORMAT: ROUND (number, number of digits)


DEFINITIONS:

  • Number: A numerical expression.
  • Number of digits: If positive, the number of digits to show to the right of the decimal point.

EXAMPLE:

$a = length instances where row = "Team 1"
$b = length instances where row = "Team 2"

Variables used to calculate the total length of time for the instances in each given row.

$c = $a + $b

Create a variable to add the results of variable $a and variable $b.

$d = ($a/$c)*100

Create a variable to calculate the % total possession for "Team 1" and adds the "%" symbol.

$e = round($d,0) + "%"

Variable rounds down the numerical % to zero decimal places (e.g., 30% rather than 30.234%).