Programmatically Set History Enabled property

I have a UDT that contains many tags. I want to historize some of the tags, but I don't want to just set their History Enabled properties to true in the UDT definition because I may need a tag historized in some UDT instances, but not in others. The reason historization is conditional is because I have one UDT I'm using to model multiple instances of equipment and all the equipment is not exactly the same. I'm trying to evaluate the various options to accomplish my objective. I could create a UDT parameter corresponding to each tag and bind the History Enabled property to the appropriate parameter, but I don't like the idea of having that many parameters. I could also create multiple versions of the UDT with each one configured to historize a different combination of tags, but I don't like the idea of having that many UDT definitions. A solution that sounds the most appealing, but that doesn't exist as far as I know, is a UDT startup script from which I could evaluate the relevant equipment properties and programmatically set the appropriate History Enabled properties. Another option is to use each tag's Value Changed script to evaluate the relevant equipment properties and set the History Enabled property only if the initialChange flag is true, but I have concerns about performance with all those scripts running on every value change. Is that a valid concern? Any other ideas?

I'm certain there are ways to accomplish what you're asking (see system.tag.getConfiguration system.tag.configure) and , but on the surface it sounds like you could do some nested UDTs or just smaller UDTs. So break the main UDT into the parts that may / may not be enabled, then create larger UDTs from the necessary components, or just folder the smaller UDTs. Otherwise it sounds like you may be creating a bunch of unused tags with each instance of the UDT.