Recompute component with button only once and keep results

Hi smart guys, :slight_smile:,

hope you are all doing well. I try to develop custom component where we read columns from excel files.
Component has two inputs (file path, columns to read) and as a output list of data from excel. Everything works fine but I would like to add a third input which will react to the button (true/false) and componment recompute only when the button is clicked.

My problem is that button click change input twice false => true and back true => false. Therefore, my component recalculates itself twice and second recalculation end with empty output as input is false.

I am not able to overcome this. Is there any hack to overcome this?

Thank you for any kind of reply.

Ondřej

Hi, it would help if you can post an example of code and a GH file that gives this error.

Hi -

I’d search the forum - there are loads of threads about this.
-wim

Why do you say hi only to smart guys, I would also want to participate into discussion

My favourite hack to overcome this is actually not a hack, but simply forget about button, but use Boolean Toggle. I know that Button looks fancy, but the fact that switches back into false is also problematic for many different cases. E.g. if your component will throw some exception only when True is being set, then also you won’t notice it, because it will automatically set it back to false. So I recommend using Boolean Toggle and move forward :wink:

A late reply.

You may use True-only Button from Pancake.