# Dynamic Popups?

**URL:** <https://forum.inductiveautomation.com/t/dynamic-popups/3416>\
**Category:** Ignition\
**Created:** [October 11, 2011, 9:23pm UTC](https://forum.inductiveautomation.com/t/dynamic-popups/3416 "2011-10-11T21:23:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [October 11, 2011, 9:23pm UTC](https://forum.inductiveautomation.com/t/dynamic-popups/3416/1 "2011-10-11T21:23:06Z")

</div>

Has anybody created a window that generates it’s components dynamically based on passed parameters?

For example, one device may have 3 thermocouples while another device has 2 thermocouples. The project has a popup that shows the values of these temperature readings, but it is a hassle building individual screens for each possible combination of thermocouples (TemperaturePopup\_1Value, TemperaturePopup\_2Value, TemperaturePopup\_3Value, etc.). It would be easier to script the open window action to call the popup similar to:

`system.nav.openWindow('TemperaturePopup', {'sensor1' : 'pathToThermocouple1', 'sensor2' : 'pathToThermocouple2'})
system.nav.centerWindow('TemperaturePopup')`

or even:

```auto
sensorCount = system.tag.getTagValue("Path/To/SensorCount")
sensors = {};
for (i in range(0, sensorCount):
   sensors["sensor" + str(i)] = "Path/To/Sensor" + str(i)"

system.nav.openWindow('TemperaturePopup', sensors)
system.nav.centerWindow('TemperaturePopup')
```

while letting the popup dynamically create it’s own elements for the stuff in the parameter dictionary.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [October 11, 2011, 10:03pm UTC](https://forum.inductiveautomation.com/t/dynamic-popups/3416/2 "2011-10-11T22:03:56Z")

</div>

I am interested in this also. what I have been doing for now is making a tag on each device and just disabling the tags that arent used. I then make the visibility based on if the tag is enabled or not. kind of inefficient but it works I guess.

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [October 11, 2011, 11:48pm UTC](https://forum.inductiveautomation.com/t/dynamic-popups/3416/3 "2011-10-11T23:48:37Z")

</div>

This is on the long range roadmap as a “Repeater Container” that would clone components horizontally or vertically based on some sort of index.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [October 12, 2011, 3:13am UTC](https://forum.inductiveautomation.com/t/dynamic-popups/3416/4 "2011-10-12T03:13:37Z")

</div>

I am looking more toward using a table component and the new system.tag.gettagvalues function. I guess my biggest issue would be having the script skip a tag that does not exist without throwing an error.

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [October 12, 2011, 1:20pm UTC](https://forum.inductiveautomation.com/t/dynamic-popups/3416/5 "2011-10-12T13:20:31Z")

</div>

That is something I’m dealing with implementing now. I’m planning on adding a script to the local project to avoid these exceptions somewhat like:

```auto
def safeTagRead(tagPath):
   result = ""
   try:
      result = str(system.tag.getTagValue(tagPath)
   except: # catches all exceptions #
      result = "" # or whatever string you want to represent failure to read with #

   return result
```

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [October 17, 2011, 6:04pm UTC](https://forum.inductiveautomation.com/t/dynamic-popups/3416/6 "2011-10-17T18:04:53Z")

</div>

There isn’t a good way to dynamically construct a screen using scripting. Also, as far as reading tags - yes: use the try block to catch errors.
