Viz Channel Branding User Guide

Version 5.2 | Published June 05, 2024 ©

Working with Rules

For imported and subsequently updated playlists, you can create sets of rules that govern how pages can be automatically inserted into certain events within a playlist. Rules are applied when working with schedules or updating playlists from an external source. Any number of conditions can be applied to defined rules for exact filtering.

When rules are defined and marked as active, the following actions will automatically be applied upon receiving or updating playlists:

When schedules are received or changed:

  • For each event in the schedule, the rules engine will try to match each rule against the current event read.

  • If the rule matches it will then apply the action/page specified in the rule; if not, no action will be taken and the event will be inserted in the playlist unchanged.

Repeat this until all events are read and processed.

This section presents:

The Rules UI

Rules Overview

To create, delete or change the definitions of a rule

  1. From the main menu, ensure that the channel you want to work with is selected.

  2. Select Rules from the menu actions to bring up the user interface for working with rules:

    images/download/attachments/140813242/image-2023-10-11_16-50-11-1.png
  3. In the screenshot above, there are now two window panes on the right-hand side:

    1. In the left pane, you can create, delete, activate/deactivate, select and import/export rules.

    2. In the right pane, you can work with a selected rule: name the rule and give it the appropriate conditions and actions.

Additional Rules Operations

images/download/attachments/140813242/image-2023-10-11_16-51-37.png

  • Select by clicking the rule you want to work with, or select the appropriate icon to create, delete, activate/deactivate or import/export rules.

  • Rules can be grouped into a hierarchy with children and siblings. Hover the cursor over the create rule icon to see the options: CTRL + click to create a child rule and CTRL + SHIFT + click to create a sibling rule:

images/download/attachments/140813242/image-2023-10-11_16-55-21.png

  • Existing rules can be activated/deactivated as required. In the example below for example the rule Another_page is deactivated while Morning_Show are activated.

images/download/attachments/140813242/image-2023-10-11_16-56-6.png

The Import/Export of rules is from/to XML-files.

  • Since existing rules will be overwritten when importing rules, make sure you want to overwrite, or create a copy safely stored to disk as backup, before importing.

Defining Rules for Conditions and Actions

Once you have selected a rule, you can use the rules panel to create conditions and actions for the rule.

images/download/attachments/140813242/image-2023-6-26_16-49-34.png
Referring to the screen-shot above:

  1. Name the rule (if newly created).

  2. Create conditions. You can have as many conditions as needed. Conditions are expressions that specify if the rule should be applied. Using the various condition operators you can answer questions such as: if the next film is for the ages over 12, display a legal-age page as graphics 10 seconds into the film.

  3. Define the conditions of the rule. A rule is only applied if all the criteria in the conditions are met. Click the column Attribute, Operator or Value to select possible values from a dropdown-list or to change the actual Value. Condition types are explained in more detail in the next section, Rules criteria and conditions.

  4. If all conditions for the rule are met, the rule will be acted upon and you can specify what should happen: insert No event, a specific Page, a predefined Action or a Pilot Data Element. Clicking on the Insert page, Insert action or Insert PDE button will enable a form where you can select and configure the appropriate element.

Options in the Rules UI panel:

  • Select the Insert this Page as a reference checkbox to allow page to be added as a referenced page.

  • Select the Add a Continue action after inserting this secondary event checkbox to add Continue action after the event added by rules. This option lets you set the offset time for the continue action.

  • Select the type of offset in the Set offset combobox to set the value accordingly.

  • Select how to Override duration in the combobox and set the duration for the page. If Do not override is selected, the call-back will be the origin page.

Rules Criteria and Conditions

Any number of conditions can be applied to a rule so that the rule is applied only when specific criteria are met. If there are no conditions, rules are applied on every primary event when a playlist is imported.

Conditions are made up of an attribute representing a column in the playlist table, an operator (greater than, less than, equal to, etc.) and a value (time, number, text). Only when the condition as defined is met will the rule be applied on a particular event. Likewise, when there are multiple conditions, only when all of them are met will the rule be applied to an event.

For any event dealing with time (for example 19:00:00), the Rules can look up elements that start after a given time (>) or at a given time and later (>=). In addition, the Rules can perform partial matches on strings which lets you find primary elements that are“right before”, “first one before this” or “current one at this time”.

Rules are executed in the order they are listed. However, the order of the rules has no impact on the final result as there is no adjustment for any pages already added. This means that when you are setting up rules you should make sure that the end-result you are seeking is not dependent on the order in which the rules are run.

While defining rules, it is possible that many of them share some common conditions. By having a parent rule defined with such conditions, we can define the remaining in child rules. The child rules will therefore only run if all the conditions in parent rule are met.

Partial Match

In order to find partial matches such as “NEWS*” to match against “NEWSROOM” you must use the partial match operator (~=). This allows for string based comparisons of partial hits (“contains”) and time-based comparisons (“currently playing”).

The partial match operator can also be negated with !~= which can be read as “does NOT partial match”.

The logic for time-based look-up using the partial match operator is a proper check of the “time” (for example at 19:00:00) and start-time of a primary element (for example at 18:45:00), its duration (for example 00:30:00) and detecting that the primary element is currently on air.

Condition Types

Operator

Description

=

equal to

>

greater than

<

less than

>=

greater than or equal to

<=

less than or equal to

<>

different from

~=

partial match

!~=

does NOT partial match

RegExp

a regular expression

Regular Expressions

You can also use regexp (regular expression) in conditions. This gives near unlimited flexibility in defining conditions and is a very powerful tool. It is advisable to test any regexp before using it in a rule. It is beyond the scope of this manual to explain regexp in detail. Please see one of the many books or internet resources that explain RegExp.

Some simple examples for the RegExp operator are shown below.

Attribute

Operator

Value

Meaning

Description

RegExp

^[a|b|c]

Description begins with a or b or c

Description

RegExp

[a|b|c]$

Description ends with a or b or c

Description

RegExp

^a.*b$

Description starts with a and ends with b

Description

RegExp

^[a|b].*[d|e]$

Description starts with a or b and ends with d or e

Description

RegExp

^[a|b]|[d|e]$

Description starts with a or b or ends with d or e

Description

RegExp

^(?=.*a)(?=.*b).*

Description contains a and b

Description

RegExp

^(?=.*a)|(?=.*b).*

Description contains a or b

Description

RegExp

^((?!a).)*$

Description does not contain a

Description

RegExp

^(?=.*a)(?!.*b).*

Description contains a and does not contain b

Description

RegExp

\+

Description contains +

Back up and Restoring Rules

All rules and their associated conditions can be saved as XML files for later use.

To back up Rules

  1. Select your channel.

  2. Click the Rules button. The list of rules is displayed in the pane.

  3. Click the Export Rules icon.

  4. Enter a file name and click Save.

To restore Rules

  1. Select your channel.

  2. Click the Rules button. The list of rules is displayed in the right pane.

  3. Click the Import Rules icon. You are asked to confirm the overwriting of any existing rules.

  4. Click Yes to proceed.

  5. Select the XML rules file and click Open.