# Perspective Table question

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-question/72441>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [April 14, 2023, 2:36am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441 "2023-04-14T02:36:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [April 14, 2023, 2:36am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/1 "2023-04-14T02:36:27Z")

</div>

![1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/78e73a7c366702e18de5d86ab417f7dec92c5b6c.gif)

I want to open a pop-up when I click on the United States row like picture "1". Is it possible?

If possible, please tell me how to do it.

---

<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 14, 2023, 3:08am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/2 "2023-04-14T03:08:54Z")

</div>

You can use the onRowClick event handler to do this:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/9/e988c4b8dd1f4f2af239b5cf98162b86693a29d3.png)

(Right click on the table and click on "Configure Events...")

---

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [April 14, 2023, 4:22am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/4 "2023-04-14T04:22:13Z")

</div>

Thanks for letting me know. But when I click finland, another window should come out. What should I do in this case?

---

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [April 14, 2023, 4:41am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/5 "2023-04-14T04:41:12Z")

</div>

For example, when pressing United States, 'params = text' is entered and

What should I do to make it enter 'params = hello' when I press Finland?

 ![1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/8/f8a000781ea16dc4903b707a8263c6be112a61c5.gif)

---

<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 14, 2023, 6:02am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/6 "2023-04-14T06:02:23Z")

</div>

```auto
country = event.value.country
system.perspective.openPopup(id='bob', view='test7', params={'TEXT': country})

```

If you really wanted "hello" if Finland, then:

```auto
country = event.value.country
if country == 'Finland':
	country = 'hello'

system.perspective.openPopup(id='bob', view='test7', params={'TEXT': country})

```

---

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [April 14, 2023, 6:21am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/8 "2023-04-14T06:21:50Z")

</div>

Wow!! Thank you so much!!

---

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [April 17, 2023, 12:30am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/9 "2023-04-17T00:30:08Z")

</div>

When I selected Finland, the pop-up worked fine.  
No pop-up window appeared when pressing Indonesia  
What should I do?

 ![2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/7/5706655f3cc25f0265969d4932800a09b822c5e2.gif)

---

<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, 12:42am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/10 "2023-04-17T00:42:39Z")

</div>

if `country != 'Finland'`, then `a` doesn't exist and the code is halting.

Try this instead:

```auto
country = event.value.country

if country == 'Finland':
	a = 'hello'
elif country == 'Indonesia':
	a = 'Indonesia'
else:
	a = 'something else'

system.perspective.openPopup....

```

ps. it's best to avoid calling the same function for different cases; it's better to call it once after setting up the variables passed as the args of the function inside the case (ifs) statements.

E.g. instead of:

```auto
if condition1:
   funcCall(1)
elif condition2:
   funcCall(2)
...

```

do this:

```auto
if condition1:
   index = 1
elif condition2:
   index = 2
else:
   index = -1

funcCall(index)

```

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [April 17, 2023, 12:50am UTC](https://forum.inductiveautomation.com/t/perspective-table-question/72441/11 "2023-04-17T00:50:03Z")

</div>

The code has to be structured in a way where all referenced variables have an assigned value.

**Example:**

```auto
#def runAction(self, event):
	country = event.value.country
	
	if country == 'Finland':
		a = 'hello'
	elif country == 'Indonesia':
		a = 'Indonesia'
	else:
		a = 'None'
	#system.perspective.openPopup(id...

```

Note how the variable is assigned a value no matter what country equals.
