Scoreline graphic: Part 3

Improvements to the 'Scorelines' parent hook

Caveat: You need to have Template Editor permissions. It may be sensible when naming new hooks, new templates or new template sets to add "TRAINING" as part of the name, to differentiate your work from 'live' production work. Do consider any 'Delete' actions carefully - is it your work you are deleting?


'Scorelines' Parent Hook


You will need the 'mepvsat' Lookup.


Improvements


You are now going to re-visit the parent hook you created in the tutorial 'Part 1' and make some improvements.


Using Ignition Post Win Client as a Template Editor.


  1. Select the main tab DATA

  2. Select the sub-tab SCHEMAS & HOOKS

  3. Below SCHEMAS:

    1. Data Provider: XMLTeam

    2. Target: Production

    3. Schema: soccer event-report

    4. Sample Data: Southampton v Leicester City

  4. Select the parent hook - 'Scorelines'

    1. Expand to the sub-hook: Scorer

    2. Expand 'Scorer'

    3. Select 'Scorer'


You have set the 'Select Mode' to 'Single Item' to ensure you only get the first item that matches and to let other hooks and controls know you only ever intend to return one item.


The node being used is itself a list element in data and you can see more than one player, e.g. for those in the 'assist' role. This is why you set a constraint on this hook to restrict it to the data you wish to use.


  1. Select the sub-hook - 'Player Idref'

    1. Set Reference = All Players

    2. Click 'Create Hooks'

    3. Expand 'Player Idref'


Scoreline graphic: Part 3


  • Select the sub-hook - 'Team Idref'

    1. Set Reference = All Teams

    2. Click 'Create Hooks'

    3. Expand 'Team Idref'


    Scoreline graphic: Part 3


  • Expand 'All Players'

    1. Highlight 'Index of Count'

    2. Ensure the sample data is set to:

    3. SampleData/soccer event-report/Southampton v Leicester City.xml


    Remember - You used a composite hook to create the above 'Index of Count' hook, which combines two component hooks. There are varying formats to combine hooks.


          Hook Evaluation:
          [Index of Count]: 1 of 36
          [Index of Count]: 2 of 36
          [Index of Count]: 3 of 36
          ....the same 4 thru 32....
          [Index of Count]: 33 of 36
          [Index of Count]: 34 of 36
          [Index of Count]: 35 of 36
          [Index of Count]: 36 of 36


    There are three goals in this match (i.e. 'Southampton v Leicester City'). So, to be specific, from the XML Data Provider there are:

    • 3 x 'action-soccer-score'


    1. In 'Working Set' select the parent hook - 'Scorelines'

      1. Expand 'Scorelines'

      2. Highlight the sub-hook 'Index'


      3. Hook Evaluation:
        [Index] 1
        [Index] 2
        [Index] 3

      4. Highlight the sub-hook 'Count'


      5. Hook Evaluation:
        [Count] 3


    If you were to combine the 'Index' and 'Count' in a composite hook, you would get:

      1 of 3
      2 of 3
      3 of 3


    1. Ensure 'Scorelines' is highlighted

    2. Selecting each sub-hook in turn you will now examine the 'Hook Evaluation' for each of the following:

      1. minutes-elapsed

      2. period-value

      3. score-attempt-type


    The 'Hook Evaluation' of each sub- hook can be seen in the following three images:


    Scoreline graphic: Part 3
    Scoreline graphic: Part 3
    Scoreline graphic: Part 3


    It is possible to combine the three above hooks to achieve the following:

      52_2_regular
      56_2_regular
      92_2_regular


    It is then possible to use a Lookup to convert the above to something more meaningful. The 'regular' simply means it was not an own-goal or a penalty, so is ignored. An own-goal can become (OG) and a penalty can become (P). If a score is in extra-time in the first half, this can be seen from the period-value being equal to '1'. So, even though a goal can be scored at 48 minutes in both the first half and the second half, they can be distinguished.


    The above would become:

      52'
      56'
      90'+2'


    Now using a slightly different combination, as per the below example:

      48_1_penalty


    You would then get:

      45'+3' (P)


    In the two images below you can see what the content of the CSV file in the Lookup looks like:


    Scoreline graphic: Part 3
    Scoreline graphic: Part 3


    You will now put to use, what you now know about the ability to combine data from different hooks and how to then convert the combination to something more meaningful.


    1. Ensure 'Scorelines' is selected, click 'Add Composite Hook'

      1. Rename: mepvsat

      2. Ensure the 'Composite Mode' is: Concatenate

      3. Enter an underscore (i.e. '_') in the 'Format' field

    2. Add the following component hooks (Below 'Search Available Hooks' expand 'Scorelines'):

      1. Minute Elapsed

      2. Period Value

      3. Score Attempt Type

    3. Switch from the 'Component Hooks' tab to the 'Lookups' tab

      1. Click within the field adjacent to 'Lookup' and select: 'mepvsat' and select 'Description'

      2. Click 'Add Fallback Hook' and in the 'Fallback's field, select the hook; Minutes Elapsed


    If there was a very long period of extra time - i.e. 126.

    The provided lookup only goes up to 125 (90'+35'(P) for 125_2_penalty).

    Therefore, the 'Fallback' would return 126.


    The below image shows the 'Working Set' pane with the 'Scorelines' parent hook and its mepvsat composite hook expanded:


    Scoreline graphic: Part 3


    To summarise:


    So if a 'minutes-elapsed' of 48' has an associated 'period-value' of 1, then it must be in the first-half and hence in extra-time. If the 'period-value' is 2, then obviously it is in the second half. The same can be said for a 96' occurrence. If it has a second-half 'period-value' of 2, it can be said to be 90'+6'.


    In this article, you are not dealing with a competition match, which could at the end of normal-time be tied and therefore Extra-Time has to be played and maybe even Penalties.


    If 'minutes-elapsed', 'period-value' and 'score-attempt-type' are combined the output could be; for example; '48_1_penalty' and '48_2_own-goal'. Therefore, you need a lookup to deal with each possibility. So these two examples become 45' + 3' (P) and 48' (OG). Normal score occurrences are included in the lookup, so, '54_2_regular', simply becomes: 54'


    Further Hooks


    You still need a few more hooks to be able to move meaningfully between the different instances during a match.


    1. Ensure 'Scorelines' is selected, click 'Add Composite Hook'

      1. Rename: Score

      2. Ensure the 'Composite Mode' is: Concatenate

      3. Enter a dash (i.e. '-') in the 'Format' field

      4. Add the following component hooks (Below 'Search Available Hooks' expand 'Scorelines'):

      5. Score Home

      6. Score Away

    2. Ensure 'Scorelines' is selected, click 'Add Composite Hook'

      1. Rename: Selector

      2. Change the 'Composite Mode' to: Format String

      3. Set the 'Format' field to: {0} {1} {2} [{3}]

      4. Add the following component hooks:

      5. Schedule Condition Hooks.Event Name Abbr

      6. Scorelines.Scorer.Player Idref.Last

      7. Scorelines.mepvsat

      8. Scorelines.Score


    A Hook Evaluation now shows you have a very meaningful hook that can be used to select points during the match when goals have been scored. The below image shows what you can obtain:


    Scoreline graphic: Part 3


    What about the ability to select points during the match that are not goals, for example, half-time and full-time?


    Fixed Event Options


    This list does not yet include rows for the other 'notional' events, so you now need to include the fixed entries for 'Pre-Match', 'Start', 'Half-Time' and 'Full-Time'. You can do this using the 'Fixed Row' list transform. This allows you to specify one or more extra rows of data to always appear, whatever else is supplied in the actual data feed. The item values available in the fixed rows are the same as the current value hooks already in the list. For each value, you can specify either a fixed constant value or the result of another hook. The list's hooks will give you data that is a merger of the fixed rows and those from data.


    In this example you want your rows to be ordered so some of your fixed rows come first, then any first-half goals from data, then a fixed half-time row, followed by second-half goals and a full-time row. You will use a combination of the period-value and the sequence-number to sort the final list and put some numbers in the fixed row values for these, to ensure sorting in the right order.


    Below you will be adding some context to the information. Where you use 'Fixed Row', it is allowing a point during the football match to be identified - e.g. 'Half-Time'.


    1. Select the 'Scorelines' hook and add the following six ‘List Transform’ items:

      1. Fixed Row

      2. Fixed Row

      3. Fixed Row

      4. Fixed Row

      5. Order by:

      6. Order by:

    2. Taking each 'Order by' in turn, you now need to assign a hook and its use:

      1. The upper 'Order by', set to: Period Value (using – Ascending and Numerical)

      2. The lower 'Order by', set to: Sequence Number (using – Ascending and Alphabetical)


    Scoreline graphic: Part 3


  • For an option as per 'Pre-match', in the first 'Fixed Row', set the following:

    1. minutes-elapsed = 1000

    2. period-value = -1

    3. sequence-number = -1

    4. score-away = 'v'


    NOTE - The high minutes elapsed value will ensure your new rows are sorted after any actual score results. The period-value and sequence-number of -1 means they will appear first in the list (period-value 1 = first half, period-value 2 = second half etc).

  • For the 'Start' of the match, in the second 'Fixed Row', set the following:

    1. minutes-elapsed = 1001

    2. period-value = 0

    3. sequence-number = 0

    4. score-away = 0

    5. score-home = 0

  • For 'Half-Time', in the third 'Fixed Row', set the following:

    1. minutes-elapsed = 1002

    2. period-value = 1

    3. sequence-number = 999999998

  • For 'Full-Time', in the fourth 'Fixed Row', set the following:

    1. minutes-elapsed = 1003

    2. period-value = 3

    3. sequence-number = 999999999


    Scoreline graphic: Part 3


    NOTE - In both the rows: '1002' and '1003'; below both the columns: 'score-away' and 'score-home'; there is currently an empty field. Each of those four fields has a 'pin' icon to its left.

  • Click the 'pin' icon for each of the four empty fields

  • Each field becomes a button 'Select Hook'

  • For the 3rd Row (i.e. 1002 - Half-Time) score-away - click the button 'Select Hook', then:

    1. From the 'Search Hooks' list, below 'Away Team', select 'Away HT Score' and click 'OK'

  • For the 3rd Row (i.e. 1002 - Half-Time) score-home - click the button 'Select Hook', then:

    1. From the 'Search Hooks' list, below 'Home Team', select 'Home HT Score' and click 'OK'

  • For the 4th Row (i.e. 1003 - Full-Time) score-away - click the button 'Select Hook', then:

    1. From the 'Search Hooks' list, below 'Away Team', select 'Away FT Score' and click 'OK'

  • For the 4th Row (i.e. 1003 - Full-Time) score-home - click the button 'Select Hook', then:

    1. From the 'Search Hooks' list, below 'Home Team', select 'Home FT Score' and click 'OK'


    Scoreline graphic: Part 3


    Your next tutorial is:

    Scoreline graphic Part 4