# Popup Generic Template

**URL:** <https://forum.inductiveautomation.com/t/popup-generic-template/72538>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [April 17, 2023, 6:54pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538 "2023-04-17T18:54:31Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [April 17, 2023, 6:54pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/1 "2023-04-17T18:54:31Z")

</div>

Good day. I am looking at creating a general template for a popup that i can use multiple times over. I have a base view created that looks something like this:

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

I would like to be able to select one of larger squares and it popup a window with that information for the position.

Which component would be good for this? Would I need to have the squares have some value that passes to the popup?

Thanks for the help

---

<div class="post-metadata">

**Author:** ![Simen\_Minerd](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Simen\_Minerd](https://forum.inductiveautomation.com/u/Simen_Minerd)\
**Post date:** [April 17, 2023, 6:56pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/2 "2023-04-17T18:56:48Z")

</div>

Perspective or Vision?

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [April 17, 2023, 7:00pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/3 "2023-04-17T19:00:51Z")

</div>

This varies greatly with what information is contained in each of those little squares and where it comes from, but from a quick glance, it looks like the Pos number of each square is unique (?), so you may be able to leverage that as a parameter you pass into the popup. Even if the Pos field isn't unique, there should still be a way that you're differentiating one Pos from another - use that in the popup to query a record from a DB, read a tag, or whatever action you need to take to get that specific square's information.

This is a very common paradigm I use all of the time (esp if you want to reuse components).

---

<div class="post-metadata">

**Author:** ![Simen\_Minerd](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Simen\_Minerd](https://forum.inductiveautomation.com/u/Simen_Minerd)\
**Post date:** [April 17, 2023, 7:01pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/4 "2023-04-17T19:01:11Z")

</div>

If you every square has the same properties, you can just pass the property (for example ".value") as parameter to the popup.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [April 17, 2023, 7:20pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/5 "2023-04-17T19:20:06Z")

</div>

It will be in perspective. The information will be same in each square, just different positions. I think Im hearing I should give each one of these squares a custom property and push that property into the popup via script?

---

<div class="post-metadata">

**Author:** ![Simen\_Minerd](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Simen\_Minerd](https://forum.inductiveautomation.com/u/Simen_Minerd)\
**Post date:** [April 17, 2023, 7:23pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/6 "2023-04-17T19:23:05Z")

</div>

I just tested my method, it worked. You can pass property to popups. In perspective, you cannot group it, but you can still put objects in a container.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [April 17, 2023, 7:24pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/7 "2023-04-17T19:24:31Z")

</div>

Do you mind sharing your method? Thank you

---

<div class="post-metadata">

**Author:** ![leonardo.godoi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/leonardo.godoi/32/27178_2.png) [@leonardo.godoi](https://forum.inductiveautomation.com/u/leonardo.godoi)\
**Post date:** [April 17, 2023, 7:56pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/8 "2023-04-17T19:56:18Z")

</div>

Have you seen this lesson on inductive university?

> **[Parameterized Popup Views Video at Inductive University](https://inductiveuniversity.com/videos/parameterized-popup-views/8.1)**
>
> In this lesson, we demonstrate how to take a value and pass it to a popup view.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [April 17, 2023, 8:07pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/9 "2023-04-17T20:07:42Z")

</div>

I had not seen it yet. Thanks

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [April 17, 2023, 8:10pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/10 "2023-04-17T20:10:59Z")

</div>

I think I got what I want for this. I made a custom property for each of the squares and had it write to a custom.session property. From there on the popup I gave it a parameter that looked at the custom.session property, then used that to do indirect addressing so it would fill in the indirection and grab the tags I needed to display.

---

<div class="post-metadata">

**Author:** ![leonardo.godoi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/leonardo.godoi/32/27178_2.png) [@leonardo.godoi](https://forum.inductiveautomation.com/u/leonardo.godoi)\
**Post date:** [April 17, 2023, 8:18pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/11 "2023-04-17T20:18:34Z")

</div>

What i would do is first have my tags organized in a folder where each "Pos" is an UDT instance, currently i'm in a project where i have some buffers so i have an UDT instance with all the info for each buffer position like this:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/ac5b395333017ea99506e149d1ceef41379be042.png)  
The second thing i would do is name each square with "Pos" + it's number so it matches what my udt instances are called, like this:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/8/88e5c8bbf48bd32218d3ac02d3beba445089b685.png)  
Third, i would select all of my squares, press CTRL + J to open the event configuration window for all of them and add this action under either "actionPerformed" or "mouseClicked", this will toggle open a popup and pass the name of the square clicked to a property called "PosString" on my popup.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/8/58e0f0aa53055bc50883c7e383d8a3363407cadf.png)  
And finally, i would make a indirect tag binding to the root of the UDT so i get all the info about the Pos on my popup, the indirect value will come from the parameter passed to the popup from the script on each square:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/4/b418f004569053615200b51e273b47195821b56a.png)  
My pos numbers are sequential, so every time i can make one square with everything i want and then just copy it and place on my screen, ignition will automatically name it with the next number, if i make Pos1 and copy and paste it on the same screen, it will already be named Pos2 for me so i don't have to worry about the custom property of each square.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [April 17, 2023, 8:43pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/12 "2023-04-17T20:43:34Z")

</div>

Gotcha, thanks

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 17, 2023, 9:19pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/13 "2023-04-17T21:19:48Z")

</div>

Fwiw, I would _always_ pass in the tag path to the Pos UDT instance to the template and into the popup. E.g. in Leonado's example, I would pass in "[default]Buffers/Pos1" into the popup. I would also pass this tag path into the template graphic itself, rather than passing in simply the "1", "2", etc.

When I first started using Ignition, I _did_ used to pass in things like parts of tag paths such as an integer index, but I found a _lot_ of the time this would come back to bite me as I would then need to use the template for another area or multiple areas with different tag path structures, so the paradigm no longer worked, or was difficult to accommodate for.

In the end, I replaced this with simply passing in the full path to the UDT instance into _all_ of my templates and parameterised popups that display info for a UDT instance. This also allows you to use the [`props.dropConfig`](https://docs.inductiveautomation.com/display/DOC81/Drop+Configuration) to enable you to drag UDT instances from the tag browser onto a View to add embedded views to the page that have their parameters auto-configured.

---

<div class="post-metadata">

**Author:** ![Simen\_Minerd](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Simen\_Minerd](https://forum.inductiveautomation.com/u/Simen_Minerd)\
**Post date:** [April 18, 2023, 12:41pm UTC](https://forum.inductiveautomation.com/t/popup-generic-template/72538/14 "2023-04-18T12:41:01Z")

</div>

I used UDT for my project too.  
For his/her example, it he/she does not want to change the squares, and all he wants to do just add event to open popup; he can use script or popup to do it. I learnt from other guys here that using event-script is better than event-popup.
