System.dnp function not working when device name is on variable

I am trying to use system.dnp.demandpoll function but is showing error when I enter variable. With direct string format it works like directly in double qoutes.

Tag (Memory-String) that I am reading:
image

This is script on button action
image

The error message

Need help!

Check the docs for the return type of system.tag.readBlocking(). Your device_1 is not a string. The string you think you are getting is nested two levels deeper.

2 Likes

Ok so I wrote these two line for saving the output on a label and it is a string

image

but when I send this variable to dnp function it gives same error

image

Don't ever use Perspective display components to try to determine a type; we worked extremely hard to make it so you could throw complex values into props and we would make a best-guess effort to display what you might be looking for.

Try this: self.getSibling("Label").props.text = str(type(device_1))

Anyway, I'm betting your "type" is a QualifiedValue, but I am a bit surprised if that's the case and the .dnp function isn't able to use it as a string. If you are seeing QualifiedValue, do readBlocking(...)[0].value

2 Likes

You shouldn't be. Perspective is (almost) the only place in Ignition where you can drop a QV and have it automagically use the inner value.

1 Like

Perspective is (almost) the only place in Ignition I live.

2 Likes

[0].value worked!

1 Like

Hah.

I'd like to chastise whoever made the [series of unkind adjectives] decision to wrap everything in Perspective in QVs. Sigh.

Fixed for 8.3, perhaps?

/runs away

1 Like

Run far. Run fast.

1 Like