Is it possible to listen for a variable value rather than triggering on variable change with a custom widget?

I’m having trouble finding a way to get my custom widget to run triggers based on the value of a variable rather than triggering on a variable change. I need to be able to keep running the triggers until my request bit has been updated back to a value of 0 but I also can’t loop within the widget because I need it to process other triggers between it’s own runs.

Is there a way to manage this without using an additional “handler” custom widget to manage requests?

Hi Bryan! Welcome to Tulip Community :tada:

Do you mind sharing a bit more bout your use case and what the goal of your custom widget is? Any screenshots you can provide may be helpful as well!

Hey Bryan,

If you look at my response to this similar community question, I believe you should be able to grasp how this can be achieved.

1 Like

Hi Beth,

The basic premise is that I am creating apps that run a lot of API/connector calls. I have some groups of 3-5 triggers that I would like to abstract out of the step triggers because I run them so many times. I thought the easy way to do this would be to just set a “request” variable to true and run the group of triggers on that variable state. Turns out tulip doesn’t have a way to trigger on variable states (or values) so I built my own custom widget to do it in the background at widget level.

I now have run into the need for my custom widget to call itself again if the responses aren’t correct or would have changed. So the following is a simplified set of steps I’m going through:

  1. Step trigger: writes 1 to “request” variable
  2. Custom widget: sees that “request” = 1
  3. Custom widget: runs group of connector functions to input part status info
  4. Custom widget: sets “request” variable to 0
  5. Custom widget: runs group of connector functions to output changes to part info
  6. Custom widget: sets “request” variable back to 1
  7. Custom widget: process complete
  8. [Custom widget should run again because “request” = 1] (I have not gotten this to work)

Does this make some sense?

Hey, it sounds like the widget should have the possibility to run itself based on a timer. What is unclear to me is if the custom widget code runs every time the Tulip step functionality scans through synchronously or if it calls the custom widget code asynchronously based on a variable change event.