Template Queries

Hello everyone!

I want to create a project with best practices, using some templates but for example:
If a have an update button in 5 windows with a different query, this button could be a template, but if this button has a different query for update.

Is there a way to do a button with a querie template ?

Like this:

Template     | How many windows will have this button? | 5 different queries, 5 different tables
Button       |  windows                                | select * from [table] where [condition]

Why do you have the query on a button, instead of on a binding on the component that will use the data, or the root container of the window? If you want to pull in the new data, you can have the button trigger a call to system.db.refresh().

If the query is bound to a custom property on the root container that works even better, because the script on the button can literally be a 1-liner of system.db.refresh(system.gui.getParentWindow(event).rootContainer, "customPropertyName")

If the property name is going to be different on each window then you can give the button template a parameter that is for the propertyName on the root container that the query is bound to, and pass that into the call to system.db.refresh()