Perspective Table question

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.

You can use the onRowClick event handler to do this:
image

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

1 Like

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

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?

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

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

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

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

Wow!! Thank you so much!!

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

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

Try this instead:

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:

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

do this:

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

funcCall(index)
2 Likes

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

Example:

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

3 Likes