To record full detail like this, you would need to store data play by play, and sum them up when you want scores.
Here is one sample TinyDB setup for this:
Use one NameSpace per game, to keep the games separate from each other. Encode the game identification (AI2GrandFinaleAug2022) in the NameSpace value, and keep track of all the NameSpace values in a separate list in the TinyDB1 NameSpace under a tag like 'NAMESPACES'.
As each event occurs, do a TinyDB add into the current NameSpace, under a tag built from Clock1.SystemTime, either formatted as yyyyMMddhhmmss or as SysemTime. Either is okay, as long as the tag grows in value as time passes.
An event could be stored as either a list or dictionary, with these parts:
- team name
- player name
- points (+/-) for this event
- event type
Note how I left out the time in the value, since it is already in the tag.
Use the TinyDB GetTagList block to get a list of all the tags, and extract values in a loop into a five column table when you want to start accumulating statistics.
Here is a draggable value procedure you can use to take grouped sums ...
group_sum.aia (7.6 KB)
I left out the value procedure you would need to build to loop through a TagList and build a 5 column table (timestamp, team, player, point, event type) from a TinyDB game.


