I have a SQL query that returns an array whereby it shows 5 generators (labeled 301, 302, 303, 304 and 305) and a TRUE/FALSE GeneratorIsMapped status for each.
Every 60 minutes, the SQL query will run. Based on which generators are mapped (where mapped = TRUE), I will perform some testing on those generators for n minutes each.
If 5 generators are mapped, then perform test on each generator lasting 12 minutes per test.
If 4 generators are mapped, then perform test on each generator lasting 15 minutes per test.
If 3 generators are mapped, then perform test on each generator lasting 20 minutes per test.
If 2 generators are mapped, then perform test on each generator lasting 30 minutes per test
If 1 generator is mapped, then perform test lasting 60 minutes.
Which Nodes are best to take the array output from the SQL query and then do the above IF/THEN? I was thinking to use a Template Node that accepts the SQL output and can decide how many of the generators are mapped (1, 2, 3, 4 or 5), followed by a Switch node with 5 outputs.
Here is another view of the output from SQL (taken from the debug pane):
[{"GeneratorNumber":301,"GeneratorIsMapped":"FALSE"},{"GeneratorNumber":302,"GeneratorIsMapped":"FALSE"},{"GeneratorNumber":303,"GeneratorIsMapped":"TRUE"},{"GeneratorNumber":304,"GeneratorIsMapped":"FALSE"},{"GeneratorNumber":305,"GeneratorIsMapped":"TRUE"}]