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?
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.
Select the main tab DATA
Select the sub-tab SCHEMAS & HOOKS
Below SCHEMAS:
Data Provider: XMLTeam
Target: Production
Schema: soccer event-report
Sample Data: Southampton v Leicester City
Select the parent hook - 'Scorelines'
Expand to the sub-hook: Scorer
Expand 'Scorer'
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.
Select the sub-hook - 'Player Idref'
Set Reference = All Players
Click 'Create Hooks'
Expand 'Player Idref'
Select the sub-hook - 'Team Idref'
Set Reference = All Teams
Click 'Create Hooks'
Expand 'Team Idref'
Expand 'All Players'
Highlight 'Index of Count'
Ensure the sample data is set to:
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'
In 'Working Set' select the parent hook - 'Scorelines'
Expand 'Scorelines'
Highlight the sub-hook 'Index'
Hook Evaluation: [Index] 1 [Index] 2 [Index] 3
Highlight the sub-hook 'Count'
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
Ensure 'Scorelines' is highlighted
Selecting each sub-hook in turn you will now examine the 'Hook Evaluation' for each of the following:
minutes-elapsed
period-value
score-attempt-type
The 'Hook Evaluation' of each sub- hook can be seen in the following three images:
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:
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.
Ensure 'Scorelines' is selected, click 'Add Composite Hook'
Rename: mepvsat
Ensure the 'Composite Mode' is: Concatenate
Enter an underscore (i.e. '_') in the 'Format' field
Add the following component hooks (Below 'Search Available Hooks' expand 'Scorelines'):
Minute Elapsed
Period Value
Score Attempt Type
Switch from the 'Component Hooks' tab to the 'Lookups' tab
Click within the field adjacent to 'Lookup' and select: 'mepvsat' and select 'Description'
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:
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.
Ensure 'Scorelines' is selected, click 'Add Composite Hook'
Rename: Score
Ensure the 'Composite Mode' is: Concatenate
Enter a dash (i.e. '-') in the 'Format' field
Add the following component hooks (Below 'Search Available Hooks' expand 'Scorelines'):
Score Home
Score Away
Ensure 'Scorelines' is selected, click 'Add Composite Hook'
Rename: Selector
Change the 'Composite Mode' to: Format String
Set the 'Format' field to: {0} {1} {2} [{3}]
Add the following component hooks:
Schedule Condition Hooks.Event Name Abbr
Scorelines.Scorer.Player Idref.Last
Scorelines.mepvsat
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:
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'.
Select the 'Scorelines' hook and add the following six ‘List Transform’ items:
Fixed Row
Fixed Row
Fixed Row
Fixed Row
Order by:
Order by:
Taking each 'Order by' in turn, you now need to assign a hook and its use:
The upper 'Order by', set to: Period Value (using – Ascending and Numerical)
The lower 'Order by', set to: Sequence Number (using – Ascending and Alphabetical)
For an option as per 'Pre-match', in the first 'Fixed Row', set the following:
minutes-elapsed = 1000
period-value = -1
sequence-number = -1
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:
minutes-elapsed = 1001
period-value = 0
sequence-number = 0
score-away = 0
score-home = 0
For 'Half-Time', in the third 'Fixed Row', set the following:
minutes-elapsed = 1002
period-value = 1
sequence-number = 999999998
For 'Full-Time', in the fourth 'Fixed Row', set the following:
minutes-elapsed = 1003
period-value = 3
sequence-number = 999999999
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:
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:
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:
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:
From the 'Search Hooks' list, below 'Home Team', select 'Home FT Score' and click 'OK'