Automatic trigger from 0 to 12


I have a new problem. I want to automatically trigger numbers from 0 to 12 (step size 1). I want to get the forecast from the dwdweather node. 0 means the actual weather. 1 means the weather in 1 hour. And so on. So I can get the Data for the next 12 hours. For this I need the automatic trigger.

How can I solve this?

I solved this by this way, but it isn't the best way. Maybe I want to get the Data for the next 24 hours.

You could use this in a function node

for (let i = 0; i < 13; i++) {
  node.send({payload: i})
return null
1 Like

Perhaps for readability/quick reading how it works, i <= 12 will have the same effect here as i < 13. Doesn’t change the functionality a thing, but sometimes it’s quicker to understand

It's a matter of personal preference I think. I find < easier to grasp, but other brains may well prefer <=. If stepping through an array or string using the length you have to use the < which may be why I tend in that direction. Also if starting at zero then using < the number to use is the number of times you want it to go through the loop.

1 Like

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