Popup Window Templating with flexRepeater?

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

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

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

Ultimately we will have 650 instances of these buttons

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".


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.

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.

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

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.


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

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

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