# Popup Window Templating with flexRepeater?

**URL:** <https://forum.inductiveautomation.com/t/popup-window-templating-with-flexrepeater/30677>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 12, 2019, 9:48pm UTC](https://forum.inductiveautomation.com/t/popup-window-templating-with-flexrepeater/30677 "2019-12-12T21:48:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmahaffey](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaffey/32/30949_2.png) [@tmahaffey](https://forum.inductiveautomation.com/u/tmahaffey)\
**Post date:** [December 12, 2019, 9:48pm UTC](https://forum.inductiveautomation.com/t/popup-window-templating-with-flexrepeater/30677/1 "2019-12-12T21:48:43Z")

</div>

![Client](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c887da00d69d1f9e6e59156a3ed720fb92fac8c4.png)

So I’ve successfully templated out some buttons using the flex repeater, but I’m having a bit of trouble figuring out how have the button script change for each instance.

Tag directory I’m targeting, I wish to have each button made launch a screen that has a slightly different base path:

[default]Tags/Orifice Meters/Anderson 1  
[default]Tags/Orifice Meters/Government Sloan 2  
[default]Tags/Orifice Meters/Treesetm to Bonanza

 ![name%20property%20binding](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/af1ed77fb437c84cc7e5927aa46f06af41ca14c7.png)

The flexRepeater script that passes the name of the instances to the container:

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

My problem is that I cannot correctly code the script inside the templated button for launching the popup window for each instance. I thought that the correct path would be:  
[default]Orifice Meters/view.parameters.name

 ![Scripting%20for%20button%20template](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7f8ca0b3ea66b524e81402c3db0167acc4ed4cdb.png)

Ultimately we will have 650 instances of these buttons

---

<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:** [December 12, 2019, 11:47pm UTC](https://forum.inductiveautomation.com/t/popup-window-templating-with-flexrepeater/30677/3 "2019-12-12T23:47:30Z")

</div>

In instances like this, it’s important to tell us _why_ what you’re doing is not working, as opposed to telling us _what_ is not working. I’m betting that what is happening to you is that you’re encountering something like `"global name 'view' is not defined"`.

Try

```auto
extension = self.view.params.name

```

because `view` is not a defined/declared variable in your script, `view` is an attribute of `self`, which IS part of your script.

---

<div class="post-metadata">

**Author:** ![tmahaffey](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaffey/32/30949_2.png) [@tmahaffey](https://forum.inductiveautomation.com/u/tmahaffey)\
**Post date:** [December 13, 2019, 12:06am UTC](https://forum.inductiveautomation.com/t/popup-window-templating-with-flexrepeater/30677/4 "2019-12-13T00:06:52Z")

</div>

Thanks a ton. Simple mistake. I still am working to understand the architecture of your system.

Can you comment any on my methodology below for generating the individual instances for the template? My question is specifically asking if there is any better way to do this than manually type in the meter name into meters. I wasn’t sure if there is a way to generate an algorithm/iteration which scans the appropriate directory stores them in the dictionary.

 ![Scripting%20for%20button%20template](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7f8ca0b3ea66b524e81402c3db0167acc4ed4cdb.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:** [December 13, 2019, 12:15am UTC](https://forum.inductiveautomation.com/t/popup-window-templating-with-flexrepeater/30677/5 "2019-12-13T00:15:49Z")

</div>

I also noticed in at least one other thread that you’re relying on logic like

```auto
myList = ["one","two","three","four"]
secondList = []
for i in range(0,3):
    secondList.append("SomeString" + "/" + myList(i))

```

While this might be working, it introduces several instances of hard-coded values which can cause maintenance issues later on.

Consider

```auto
myList = ["one","two","three","four"]
secondList = ["SomeString/" + _ for _ in myList]

```

This removes hard-coding an indexed for-loop.

To make it even better, you could do something like

```auto
tagPathList = system.tag.browse("[default]Orifice Meters/" + self.view.params.name).getResults()

```

---

<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:** [December 13, 2019, 12:16am UTC](https://forum.inductiveautomation.com/t/popup-window-templating-with-flexrepeater/30677/6 "2019-12-13T00:16:44Z")

</div>

> [@tmahaffey](#):
>
> I wasn’t sure if there is a way to generate an algorithm/iteration which scans the appropriate directory stores them in the dictionary

Hahahaha. I was answering that way before you even replied - it just took a while to type it out.
