I am trying to force a refresh on a template repeater (via a button) but am getting error “object has no attribute ‘db’”. Any ideas on what I’m doing wrong?
TemplateRepeater = event.source.parent.getComponent(‘Template Repeater’)
system.db.refresh (TemplateRepeater, “templateParams”)
Any chance you’re running in Edge?
Edge doesn’t have db access.
Ok. Thank you. How does one go about forcing a refresh on components in Edge?
Can you give me a little more information on what needs to be refreshed? I’m having trouble thinking of a situation where a refresh wouldn’t happen automatically…
Uhm? There’s all kinds of them, especially where an expression isn’t pure. But also where things like tag history polling are turned off for user interaction – with a script triggering refresh on user command.
Cool. I rarely work on stuff that involves refreshes.
system.db.refresh() seems to be a victim of being in the wrong namespace at the wrong time
It has nothing to do with DB access and would be usable in Edge if not for the fact it gets lumped into
Thank you. I was able to force it to refresh by writing a blank dataset to the template repeater and then rewriting the original dataset back…
This particular situation involves a form that uses a template repeater. The the form can be put into an “edit” state where the user can make changes to the components but the changes are not immediately written back to the dataset used by the repeater. The user has the option to cancel pending changes. If the user cancels the changes, the components on the repeater should revert back to their original state.
A workaround would possibly be to create a String Custom property on the control, put the query for the dataset in there and then bind the repeater datasource to that custom property.
Then just overwrite the string with the query when you need to refresh, that should force the datasource to requery.
I see that Ignition 8 doesn´t have the funcion system.db.refresh from a Gateway event Script in a Tag Change??
I am trying to run a Tag Change Script from the Gateway Event (that is working), but when I put the refresh instruction, it doesn´t run the script anymore. The line that it is giving me trouble is:
system.db.refresh(system.gui.getWindow(‘Overview/Test’).rootContainer.getComponent(“Weight Charts”), “Pump1”)
I am trying to do a refresh from the Gateway event to a specific component from a specific screen. Any ideas?
Gateway events (tag events or any other Gateway Scripting event) do not have access to the GUI. You would have to send a message to clients and use a message handler to trigger the refresh, or perhaps just use a Client Scripting Tag Change event.