For this application, I would say neither. It’s one that would be easier with multiple transaction groups, but, if you have good organization of your tags, you can use a gateway tag change event script to write the events to the database.
As an example, I have a set of 4 assembly lines that I grab takt times from, each with 18 stations
The structure of the tags are similar
regex = r"(34[0-9]*)(.*)(?<=ST)([0-9]*)"
# Get the path of the tag that triggered
pathIn = str(event.getTagPath())
# Replace 'Trigger' with 'Time' to make tag path to read
taktTimeTag = pathIn.replace('Trigger', 'Time')
# Read the takt time
tag = system.tag.readBlocking([taktTimeTag])
# Get the value, quality, and timestamp of the takt time
value, quality, t_stamp = tag.value, tag.quality, tag.timestamp
if value is not None:
# Create values to put in the database
takt_time = round(value, 1) # rounded to 0.1 sec for average and std dev calculations
rounded_takt = int(round(takt_time,0)) # rounded to 1 sec for histogram fuctions. Storage is cheap.
# regex pattern search to extract line number and staion.
match = re.search(regex, pathIn)
line, fluff, station = match.groups() # 'fluff' is a throwaway value
# Insert values into the db
query = "INSERT INTO takt (line, station, takt_time, rounded_takt, t_stamp) VALUES (?,?,?,?,?)"
system.db.runPrepUpdate(query, [int(line), int(station), takt_time, rounded_takt, t_stamp], 'Takt')
My other tkat time scripts are similar, just the regexes change to cover the tag structures there. Some stations are named instead of numbered, etc. (Some of this stuff is several years plus old, and it’s taking time to normalize the tag structures. )
All of them, however insert into a single table called takt.
So, when they want to show takt time in a table. It’s a single table that I’m drawing from.