Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Loop #1

Open
markusvankempen opened this issue Apr 2, 2020 · 3 comments
Open

Next Loop #1

markusvankempen opened this issue Apr 2, 2020 · 3 comments

Comments

@markusvankempen
Copy link

Hi John... when you import the flow some of the array are not initialize adding an entry || [] default arry will help with the error message - when starting this ... See Next Loop function
var Severe = flow.get("SevereAlerts")||[];

@markusvankempen
Copy link
Author

markusvankempen commented Apr 2, 2020

I add somefilter function and limitted the a amount of API calls eg if we have all the data form the US lets just filter the array by State and Severity Level ... vs calling the API again ... anyway just couple little things
mvk.-node-red.flow.txt

@johnwalicki
Copy link
Owner

Thanks for the flow updates. Cool addition of Severity Levels. I like it. Adds a bit more complexity to an already advanced flow! I'm worried my flow already can overwhelm a novice Node-RED developer. This pushes it over the top. Ha.

I like the idea of reducing the extra calls to the TWC APIs if the flow already has all US alerts loaded. I just spent some time thinking about having the flow filter by AdminDistrictCode. In theory, the flow could make one call to get All US alerts, store that array in memory and then just filter on whichever State the user selects. The flow would never need to call the TWC more than the first time. It would simplify the flow substantially. At the expense of some extra runtime memory, that would be more efficient. I could delete the State "next loop".

BUT what's the point of this flow? I want to show how to make calls to the TWC APIs. If I delete the AdminDistrictCode logic, I lose that teaching example.

Here's what I'll do, I'll hatchet out the State code. Add the in-memory filter on the State / AdminDistrictCode selected in the drop down. That will simplify. Then, I can add your Severity dashboard nodes. I'll post the flow to github under a different name to preserve both.

In my original flow, there will never be a case where the flow variable SevereAlerts is null. It is set right before the http request nodes.

@markusvankempen
Copy link
Author

markusvankempen commented Apr 3, 2020

Ok ... I see ... flow did work for me right away - I think in the end it was the "Init TWC API Key" inject which does not fire to set the API key when you update the "change" node for some reason it kept using the old (wrong API key) ... once i fired it manually and the apikey was set with work perfectly).... anyway no worries .... Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants