Need to select active tags based on priority

I have 45 tags that are all Boolean on/off tags and ranked in priority from 1-45. I need to show the tags that are "ON" or a 1 ranked by priority in a table in vision. What would be the best way to go about this? I have been working with transaction groups, but it almost seems like I would need a separate group for each tag. Could I use a tag event script to write to a database each time it goes active?

Do you not need history? Just current value of all? If that's the case, then you don't need a database at all. I would use a single gateway tag change event (with all the tags in its list) that delegates to a function in a project script module, where the most recent value for each tag is cached in a top-level dictionary. The cache would include the tag name and the assigned priority (by custom property, perhaps). Then a timer event would regularly call a function in that same script module to iterate through the dictionary to produce a list of the True values, and then sort by priority, then feed a DatasetBuilder to yield something table-friendly, which would then be written to a memory tag.

(: