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

**URL:** <https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860>\
**Category:** Ignition\
**Tags:** python, ignition81, perspective, scripting\
**Created:** [March 5, 2024, 10:16pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860 "2024-03-05T22:16:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahad99.shalwani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahad99.shalwani/32/76824_2.png) [@ahad99.shalwani](https://forum.inductiveautomation.com/u/ahad99.shalwani)\
**Post date:** [March 5, 2024, 10:16pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/1 "2024-03-05T22:16:29Z")

</div>

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](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f6b170744e677c1ae1a371907d0cf2abc40ea794.png)

This is script on button action  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/3/f3f1b12b3ae5069e180e1bd38821bf2e11e2fe96.png)

The error message

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/9/9996ba8307488a1b1a18d636fc89d59a62d67a7e.png)

Need help!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 5, 2024, 10:20pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/2 "2024-03-05T22:20:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ahad99.shalwani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahad99.shalwani/32/76824_2.png) [@ahad99.shalwani](https://forum.inductiveautomation.com/u/ahad99.shalwani)\
**Post date:** [March 5, 2024, 10:28pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/3 "2024-03-05T22:28:04Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/a/1a448ae8971a380574e2a65d2dc3ae29c20caeba.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/8/f897bca1df0fddea092912c1811bdd7987206533.png)

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

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/b/dbbbcb0557f43726cafb25e6b6da16e1385c660f.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 5, 2024, 10:32pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/4 "2024-03-05T22:32:48Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 5, 2024, 10:36pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/5 "2024-03-05T22:36:46Z")

</div>

> [@cmallonee](#):
>
> bit surprised

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.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 5, 2024, 10:39pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/6 "2024-03-05T22:39:53Z")

</div>

> [@pturmel](#):
>
> Perspective is (almost) the only place in Ignition

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

---

<div class="post-metadata">

**Author:** ![ahad99.shalwani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahad99.shalwani/32/76824_2.png) [@ahad99.shalwani](https://forum.inductiveautomation.com/u/ahad99.shalwani)\
**Post date:** [March 5, 2024, 10:42pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/7 "2024-03-05T22:42:26Z")

</div>

[0].value worked!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 5, 2024, 10:43pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/8 "2024-03-05T22:43:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 5, 2024, 10:45pm UTC](https://forum.inductiveautomation.com/t/system-dnp-function-not-working-when-device-name-is-on-variable/86860/9 "2024-03-05T22:45:28Z")

</div>

Run far. Run fast.
