System.db.refresh() unable to refresh dataset properties of the root container

Is there a convenient way to refresh database information when the property you want to refresh is under the root container instead of to a component? I cannot seem to get system.db.refresh() to work as the first arg requires a component, and the root container doesn't seem to count as one

I have a dataset property attached to the root container of a window [LotValues] which is bound to a named query. In this window there is a toggle button which allows the user to edit information provided from the lotvalues table and have the opportunity to submit. When the toggle button goes from edit mode back to read only mode I want the dataset from [LotValues] to refresh

The property change script on my toggle switch is as follows

if event.propertyName == "selected":
	if event.newValue == 0:
		event.source.RefreshNeeded = 1
		comp = event.source.parent.getComponent("[Root Container]")
		print comp

		#system.db.refresh(comp,"LotValues")

the print statement is just for debug, but no whether the I provide "Root Container" or "[Root Container]" or all lower case for the same word I get a print statement of "None". If the root container is not a component, then how can one refresh a dataset property it?
If this is not possible does anyone know of a workaround?

Are you sure event.source.parent isn't the root container already?

You are right. I had tried that but relied on a driven text field to view the properties I was looking to refresh and assumed it didn't work when the values I expected to return from the DB didn't show up. It looks like the dataset does refresh when I set my component equal to the event.source.parent but the components driven by the dataset is not.
I'm trying to make something akin to this work, but so far I'm getting errors that the component does not have a property refreshBinding().

if event.propertyName == "selected":
	if event.newValue == 0:
		event.source.RefreshNeeded = 1
		comp = event.source.parent
		print comp
		system.db.refresh(comp,"LotValues")
		f = event.source.parent.getComponent("RequestorField")
		print f
		f.refreshBinding("Text")

RefreshBinding as a component instance method is a Perspective only concept.
In Vision, you have to use system.db.refresh, but any method of obtaining a window/template/container/component should be valid and allow you to run system.db.refresh.

the db refresh worked fine, for whatever reason several of my custom properties which were bound to that table wouldn't refresh, but deleting and recreating those properties fixed it. in theory nothing is different about them, I just needed to recreate them from scratch. thank you for your assistance.

1 Like