Tag Ondemand poll

i have a popup Window that I want to be able to perform an onDemand poll of a tag’s value but I’m getting hung up on how to do this. I don’t think my syntax is correct but this is what I have so far in the event handler of the button that will do this:
qv = system.opc.readValue(event.source.parent.getComponent(‘ServerLabel’).text + “/” + event.source.parent.getComponent(‘FolderLabel’).text + “/” + event.source.parent.getComponent(‘TagNameLabel’).text)
event.source.parent.getComponent(‘Numeric Label’).value = qv

(This is the error I get when running it - TypeError: readValue(): expected 2 args; got 1)

I’m bringing in the tag path from 3 label boxes


The reason for that error is your missing the opcServer parameter for readValue(), it expects a tagPath string and opcServer string.

inductiveautomation.com/support/ … dvalue.htm

I changed “system.opc.readValue” to “system.tag.read” and I think made a little progress… Now I’m just getting “TypeError: can’t convert to double”

If you used the same code as above, it was probably because you tried to assign the variable qv (a QualifiedValue) into a Numeric Label value (a double). Try this:

event.source.parent.getComponent('Numeric Label').value = qv.value