Dynamic String fill for the drop-down list

Hi,

I want to implement a drop-down list with filling its option strings dynamically.
The strings are stored in a string array of a UDT that from OPC tags

Take below snapshot as example, I want the “String 1” and “String 2” to be displayed in the drop-down list.
Capture

Capture2

I could get the “string 1” & “string 2” from OPC tag with JsonGet function separately by the array index.

I tried to use data set of the drop-down list widgets, it seems that it only support static strings or the dynamical string from SQL database as shown in below link
https://docs.inductiveautomation.com/display/DOC80/Vision+-+Dropdown+List+Example

Is there any way that I could fill these dynamical strings from the OPC UA tag in the property of the dropdown list widget?

Capture3

BTW, for the string array that in OPC UDT tag documention type.
Could the string array content [“sting 1”,“string 2”] in json data {list:[“sting 1”,“string 2”]}
be considered as dataset directly?

Place the following script in the VisionWindowOpened Event.

options = system.tag.readBlocking(['[providerName]UDTPath/InternalUDTPath'])[0].value  # as of v8.0+, tag.read('tagPath') if you're using v7.9.X.
headers = ['value', 'label']
data = []
for i in range(0, len(options)):
	data.append([i, options[i]])
options = system.dataset.toDataSet(headers, data)
system.gui.getParentWindow(event).getComponentForPath('Root Container.Dropdown').data = options

To place the script in the required event:

  1. Right click the Vision Window node you are using.
  2. Select “Scripting”.
  3. Expand the “visionWindow” folder.
  4. Select “visionWindowOpened” event.

@cmallonee
Really appreciate your help. I will try with your comments tomorrow.

Finally, I use another workaround by filling the dataset of drop-down list with items listed in database.