Dropdown list script

I have the following script to populate a dropdown list:

def fillDropdown():
import system
data = []
header = [“values”,“path”]

data.append([1,system.tag.read ('JellyBean/Rcp1')])
data.append([2,system.tag.read ('JellyBean/Rcp2')])
data.append([3,system.tag.read ('JellyBean/Rcp3')])
data.append([4,system.tag.read ('JellyBean/Rcp4')])
data.append([5,system.tag.read ('JellyBean/Rcp5')])
data.append([6,system.tag.read ('JellyBean/Rcp6')])

return system.dataset.toDataSet(header,data) 

It all works ok but on the list I get something like:

[“value of the tag1”,Good]
[“value of the tag2”,Good]
[“value of the tag3”,Good]

How do I get rid of the “Good”? I just want to display the value of the tags in the list.
I tried modifying the headers to just have the value but then I get an error about Row 0 not having the same number of columns as the header.

system.tag.read returns a QualifiedValue object, and what you’re seeing is a string representation of that object showing its value and quality.

You can get the value alone out of a QualifiedValue by accessing the .value property.


Spot on. As usual.


[quote=“kcl”]Spot on. As usual.


Glad I could help :thumb_left: