Dynamic Search of UDT Members - Dropdown List

Looking for some advice for the best way to dynamically search a folder of data types tags and return a value of a string from it, but I only want the returned tags to match a set of parameters.

So I have 100 Tanks that hold a value of product in a string inside a datatype. I then have another datatype that is my Origin that I want to compare the string and populate a Dropdown List where the operator will be selecting an origin product from SQL. The Dropdown list can only show the tanks that match what the operator selected in the Origin datatype.

It will also have other logic that will filter it even more like if the tank is ready for the product it will be included. If it is in a Hold mode it would exclude it from the list even if the product matched.

Hopefully, that makes sense. I started to go down the route of using System.Tag.Browse, also thought about just having a SQL Insert script in the datatype and store the product in a SQL table.

Appreciate any advice.

I do something kind of similar to dynamically build a dataset for a template repeater. I get all of the UDT names inside of a specific folder and then append those names to a list to make a data set. You could probably do something similar and then compare that dataset with one from a SQL query or some other filter and remove items or not append them at all.

#build dataset for device communication template repeater
tags = system.tag.browseTags(parentPath="[default]Communication Error Tags/Kepware Devices/")
header = ['Device']
rows = []
for tag in tags:
data = system.dataset.toDataSet(header, rows)
system.gui.getParentWindow(event).getComponentForPath('Root Container.Container.Template Repeater').templateParams = data

Just wanted to give an update in case anyone else ran across this.

It was proving to be to difficult to use system.tag.browse then using the results to read all the tags in the UDT that I needed to read and then compare those results in a calculation and put into a dataset for a combobox.

The end result I used that seems to work good is use the new tag scripting in tags, I created a few expression memory bool tags in the data type and use that as a trigger for a script, then use a SQL update statement in the tag script to keep a table as a current “Live” product table. Then use the combo box to call a simple select query using a named query to filter out the tanks using SQL language.