Binding a text field to a power table cell value

Hi,

I have made a power table that can be clicked on to open a popup window to update values. the thing is I want to bind a text field value in that popup to the same string value of a cell from the selected row. I wasn’t able to address the getValueAt function correctly.

any support is appreciated.

You can pass that value as a parameter to the view your popup uses, assuming you only want to display that value.
If you wanted a bidirectional binding so that editing the field in the popup view will update the value in your table, I guess you could use messages…

thanks for the replay but I am using power table’s extension function on double click, how can I pass a parameter through it? I actually pulled it off but I am having another problem I will explain it on another reply.

Update…

I have made it but with a little bit of an issue, the text field now takes a value from a power table for the first time only, and it will be same always no matter how much I close the popup or click on different rows. Except if I completely close the vision client and re-open it, then the value gets updated only with the first row clicked and it will be stuck at that value.

so here how I did it, I made a shared script as follow:

window = system.gui.getWindow(‘CMMS Main window’)
table = window.rootContainer.getComponent(‘Power Table’)
row = table.selectedRow
col = 3

value = table.data.getValueAt(row, col)

def getvalue():
return value

then in the text field expression I used :

try(runScript(‘call_value.getvalue’,1000), ‘no value’)

I used try() because designer will give me error when no value is selected since I am not in preview mode.

I believe the script only runs once and that’s why the value get stuck on the first time the code runs. Any work around this ?

thanks

what did you bind your script too?

You should not allow the popup to open when no row is selected and better not use try for this,
use an if

The popup will open under a conditioned column value, the popup will not open if no row is clicked. the issue is only to bind a cell value from the power table to a text field in the opened popup. I managed to pass a value but only the first time a popup is opened. Then any time I try to open the pop up it will have the same first value no matter which row is selected. I hope I am explaining this clearly

You are explaining it fine, but the code is not working as you want it too, there has to be something wrong somewhere in it.
So to help we will need some screenshots of everything related.
the table, where you open the popup, where you bind the values, the scripts …
and maybe show us the popup with the wrong value and the selected row property

Oh I’m sorry, didn’t notice you were using vision. Perspective allows passing parameters to the view your popup opens:

I don’t know anything about vision…