I’m looking for an elegant way to have a list of the used UDT in a provider
my solution work but use a lot of interaction to find the result; same idee
results = system.tag.browse(provider, {"tagType": "UdtInstance", "recursive": True}
).results
myUdtList = []
for item in results:
if item['typeId'] not in myUdtList:
myUdtList.append(item['typeId'])
I don’t see how you would get around browsing for the instances you wish. However, this is a task that should not be run every time you need the information. You should run it as a script module initialization background task, and cache the results in a script module top-level variable (dictionaries work well for such). Possibly perform a re-browse regularly. Possibly do the browse in the gateway and publish the results in a dataset or document memory tag.