COUNT

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

This command will count the number of labels in the timeline, including multiple ones in the same instance.


FORMAT: COUNT "label_name" or COUNT instances


DEFINITIONS:

  • label_name: Quoted text specifying the label you wish to count in the front timeline or instances. (Can be grouped using OR, AND, NOT)
  • instances: The script matches all the sequences without regards to the labels.

EXAMPLE 1:

$instances = count instances
show $instances

Counts the number of instances among all the rows of the timeline. The result is stored in the $instances variable and then displayed using the SHOW command.

EXAMPLE 2:

$goal = count "GOAL"
show $goal

Counts the number of instances containing the label "GOAL" among all the rows of the timeline. The result is stored in the $goal variable and then displayed using the SHOW command.

EXAMPLE 3:

$possessions = count instances where row = "POSSESSION"
SHOW $possessions

Counts the number of instances in the row called "POSSESSION" of the timeline. The result is stored in the $possessions variable and then displayed using the SHOW command.

EXAMPLE 4:

$goal = count "GOAL" where row = "Messi"
show $goal

Counts the number of instances containing the label "GOAL" in the row called "Messi" of the timeline. The result is stored in the $goal variable and then displayed using the SHOW command.

EXAMPLE 5:

$goal = count "GOAL" AND "FREE KICK" where row = "Messi"
show $goal

Counts the number of instances containing the label "GOAL" and the label "FREE KICK" in the row called "Messi" of the timeline. The result is stored in the $goal variable and then displayed using the SHOW command.

EXAMPLE 6:

$goal = count "GOAL" OR "FREE KICK" where row = "Messi"
show $goal

Counts the number of instances containing at least one of these two labels "GOAL" and "FREE KICK" in the row called "Messi" of the timeline. The result is stored in the $goal variable and then displayed using the SHOW command.

EXAMPLE 7:

$goal = count "GOAL" AND NOT "FREE KICK" where row = "Messi"
show $goal

Counts the number of instances containing the label "GOAL" in the row called "Messi" of the timeline, excluding instances containing the label "FREE KICK". The result is stored in the $goal variable and then displayed using the SHOW command.

EXAMPLE 8:

$goal = count "GOAL" where row != "Messi"
show $goal

Counts the number of instances containing the label "GOAL" in the timeline, excluding instances in the row "Messi". The result is stored in the $goal variable.