Refreshing Power table-Vision


I have designed a power table as below,

the table will be loaded once load button is clicked.
And on right clicking the row, i have written onPopuptrigger to open a popup window.

def onPopupTrigger(self, rowIndex, colIndex, colName, value, event):
	# Example for displaying a popup menu:
	self.parent.LossScreen = True
	iStart =, 0)
	iEnd =, 1)
	iProcess = self.parent.Process
	iMachineID = system.tag.readBlocking("[client]MachineNo")[0].value
	self.parent.LossScreen = True
	window=system.nav.openWindow("Main Windows/Machine/Update BreakDown Reason",params)

Popup Window,

In this window, i will be updating the breakdown reason for the machine. I would like to refresh the table once the save button is clicked.
Save Button :
iEnd= event.source.parent.iEnd
iMachineID= system.tag.readBlocking(“[client]MachineNo”)[0].value
vReason = event.source.parent.getComponent(‘Group 4’).getComponent(‘orderNo’).text
params ={“vStart”:iStart,“vEnd”:iEnd,“vMachineID”:iMachineID, “vReason”:vReason}

system.gui.messageBox(“Breakdown reason updated”)

window = system.gui.getWindow(‘Main Windows/Machine/Loss Time’)
dataTable = window.getRootContainer().getComponent(‘Power Table’)
system.db.refresh(dataTable, “data”)
system.nav.closeWindow(“Main Windows/Machine/Update BreakDown Reason”)`

But currently, the table is not updating unless i reload the page. Am i missing something?

Try removing the system.gui.messageBox or moving it to the end of the script. Nothing about your script looks wrong from what I can tell.

No. Still it is not working!

Are you sure your path to the power table correct? Is it in the root container and not in a group?

Yes i think so.

Maybe check and see if you’re query is working as intended

update = system.db.runNamedQuery("MachineBoard/updateBreakDown",params)
print update

Query is wokring. Because when i reload , table is updated Where can i see the printed value??

Tools → Console (ctrl + shift + C)

make sure your script is using " straight quotes and not curly ones

Yes, I have changed.

I don’t see anything else. I’ve tried this in a designer from a script console and it works. :man_shrugging:

It seems redundant, but you could add a system.db.refresh(dataTable, “data”) to the primary window’s internalFrameActivated event handler, so it refreshes the table when it regains focus after the popup closes.

I’m just not seeing the actual problem with the code.

Either that or maybe invoke later?

iEnd= event.source.parent.iEnd
iMachineID= system.tag.readBlocking("[client]MachineNo")[0].value
vReason = event.source.parent.getComponent("Group 4").getComponent("orderNo").text
params ={"vStart":iStart,"vEnd":iEnd,"vMachineID":iMachineID, "vReason":vReason}

# system.gui.messageBox("Breakdown reason updated")

def refreshTable():
   window = system.gui.getWindow("Main Windows/Machine/Loss Time")
   dataTable = window.getRootContainer().getComponent("Power Table")
   system.db.refresh(dataTable, "data")

system.nav.closeWindow("Main Windows/Machine/Update BreakDown Reason")

Does the named query use any caching? What’s the logic on the Load button - perhaps it is clearing the named query cache before reloading the table.

1 Like

Will the event handler complete the invoke later after its window has closed?

I’m not sure.

Perhaps the problem is that the nav close is firing before the refresh has completed. Perhaps the nav close should be invoked later to delay the thread termination a bit.

No .it is not working as expected.

Script in Load button:

event.source.parent.getComponent('Label').visible = True
event.source.parent.getComponent('Label').text ="LOADING..."
event.source.parent.stDate =event.source.parent.getComponent('Group').getComponent('stDate').date
event.source.parent.endDate =event.source.parent.getComponent('Group').getComponent('endDate').date
vData=event.source.parent.getComponent('Power Table').data
def checkValue():
	if  vData!= None:

		event.source.parent.getComponent('Label').visible  = False
		event.source.parent.getComponent('Label').visible  = True

vProcessArea = event.source.parent.Process
vStartDate   = event.source.parent.getComponent('Group').getComponent('stDate').date
vEndDate     = event.source.parent.getComponent('Group').getComponent('endDate').date
vEqId        = event.source.parent.MachineNo
vMinutes 	=  event.source.parent.getComponent('Group').getComponent('Dropdown').selectedValue
params       = {"iProcessArea":vProcessArea, "SDate":vStartDate, "EDate":vEndDate , "iEqId":vEqId,"iMinute":vMinutes}
#params       = {"iProcessArea":vProcessArea,  "iEqId":vEqId,"iMinute":vMinute}
#get data in a data set
#run named query
dataSet      = system.db.runNamedQuery("MachineBoard/getLossTime", params)

#bind data set to table
#event.source.parent.parent.getComponent('Table').data= dataSet
event.source.parent.getComponent('Power Table').data= dataSet

if dataSet.getRowCount()==0:
	event.source.parent.getComponent('Label').text ="NO DATA AVAILABLE..."