Refresh Button Widget reexecution only when button clicked

Hello Community,

I want to control writing data into database only in case the button “Refresh Button Widget” has been clicked.
It should actually be the default behaviour (reexecution of downstream nodes in cased when clicked). The problem is that other Widget nodes before Refresh Widget node need also to have Reexecution option enabled (in order to show the appropriate data based on user choice/input). Therefore they trigger all downstream nodes.
Any ideas how can I control reexecution after Refresh Button in this case (only when button has been clicked)?
Thank you.

Hi @volsebna,

On re-execution event in a composite view, all the following nodes get re-executed so that the component would be in the executed state and the view would be available. So, if you have enabled re-execution on value change for the preceding widgets, the Refresh Button Widget will also get re-executed followed by the DB SQL Executor node.
I would recommend to move the DB nodes to the next component so you first select data and then write it to DB.
But, from what I understood, you want to do it in the same component to stay on the same page and have a switch key (here you tried the refresh button) to let the data be written to DB or not. If I’m right, then you need a Single Selection Widget and a Case Switch to let the flow go to the DB SQL Executor or not. Something like this:

So when you select something in the previous widgets and they get re-executed, it doesn’t write anything till you confirm you want it to be written. But, there is an issue here, as soon as you change the value of the Single Selection Widget, it will remain the same as long as you change it back. That may be annoying and also, it’s possible that you forget to change it back and by changing a value in a widget, the data goes to DB unintentionally. So, what’s the solution? You need the Single Selection (confirm) value to be reset to default after each submission. But how to revert the value to default without leaving the current page? Actually, your post here in addition to another post by @roohith007 asking for the same thing convinced me to share this workaround:

So, this is a general example of reseting widgets to their default value without closing the wizard window (or going back and forth in a Data App).

In your case, I used the idea to provide you with this example workflow:

I have explained the method in an annotation inside the component.
I hope it helps.

4 Likes

Thank you very much for your solution @armingrudd :slight_smile:
Actually it gave me idea to move the DB SQL Executor to the next component.
Then only in case the Next button has been clicked the data will be written in DB.
Staying on the same page wasn’t necessary in my case.
Also I see “button” more convenient for action “saving” comparing to radio buttons.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.