Conditional Rules

Updated: 8/18/2020

Conditional rules are a special type of condition available in Sportzdesigner. A conditional rule is exactly what it sounds like, a rule that is applied only if a condition is met.

Remember: When you assign a rule to an element, you are telling Sportzdesigner to replace one text value with another. Specifically, if your bot provides a value for which a rule is defined, that value is replaced with the rule value.

In Sportzdesigner, the only difference between a rule and a conditional rule is that conditional rules are only applied if the user defined condition is met first. Let’s look at an example to get a better understanding.

Let’s say that you are creating a graphic for a baseball game where you would like to display the current batter’s name on the scoreboard. Since a baseball Sportzbot only provides player numbers for the at bat field, we must use a rule to convert the player numbers into their respective player names. For example, a rule defined as: 1=Joe|2=John|3=Bob|4=Rick…, would be sufficient for converting player numbers into players names.

We need a rule to display current batter's name

Enter a simple rule to convert player numbers to names

A simple rule only works for 1 team here

A problem arises, however, because there are actually two batting line-ups that must be accounted for by this rule: one for the home team and another for the away team. A single rule cannot account for this; it would have no way of differentiating between #1 on the home team and #1 on the away team. This is where conditional rules come in.

Building a conditional rule

In this example we need a conditional rule for representing the batting orders of both home and away teams, respectively.

  1. Define two rules, one for each team. Let’s define them as: 1=Joe|2=John|3=Bob|4=Rick and 1=Dirk|2=Luca|3=Kristap|4=Lars.
  2. Determine a principal element for which the rule can be conditionally applied. In this case, the away team bats at the top of an inning and the home team bats at the bottom, so the field “topbottom” is a good choice for a principal element.
  3. Define two conditions on the principal element, one for when to apply each rule.
    • If element topbottom4 has value T then element atbat2 conditional rule 1=Joe|2=John|3=Bob|4=Rick.
    • If element topbottom4 has value B then element atbat2 conditional rule 1=Dirk|2=Luca|3=Kristap|4=Lars.
  4. The rules will now be applied only when their condition has been satisfied first, allowing you to display the batting orders of both teams.

Add rule for away team

Add rule for home team

Both conditional rules

Conditional rule for away team applied

Conditional rule for home team applied


  • A simple rule takes precedence over a conditional rule. If a value has both a rule and a conditional rule defined, the rule will be applied, and the conditional rule will be ignored.
Read next: Alternate Images