Variable Value select array part
-
Hi @toggledbits
Is there any way that in the trigger the Varable Value could select the desired part of the array?
For example, I could have a global variable VarTEST$[Part1, Part2, Part3] like this: ${{ [TestText, 5, 3] }}. Use the Variable Value to validate a VarTEST[Part2] == 5 trigger.
What am I doing today? I've defined 3 global variables:
And I validate each variable.
In short, I would like to have a global variable of the array type, and be able to select which element of the array I would use for validation in a trigger.
Thanks
-
Make a local variable in the rule to extract the value you are interested in, and use the local variable in the condition.
-
Thanks master
One more help if possible, instead of doing this absurd of code, how could I make a loop, with the count from 6 to 0, that is, regressing?
format( "Dia {0} {1} {2:4.1f}mm ", substr(HistPrecipitation.daily.time[6],8,2), if HistPrecipitation.daily.precipitation_sum[6] <= 2 then "💦" else "🌧️" endif, HistPrecipitation.daily.precipitation_sum[6]) + format( "Dia {0} {1} {2:4.1f}mm ", substr(HistPrecipitation.daily.time[5],8,2), if HistPrecipitation.daily.precipitation_sum[5] <= 2 then "💦" else "🌧️" endif, HistPrecipitation.daily.precipitation_sum[5]) + format( "Dia {0} {1} {2:4.1f}mm ", substr(HistPrecipitation.daily.time[4],8,2), if HistPrecipitation.daily.precipitation_sum[4] <= 2 then "💦" else "🌧️" endif, HistPrecipitation.daily.precipitation_sum[4]) + format( "Dia {0} {1} {2:4.1f}mm ", substr(HistPrecipitation.daily.time[3],8,2), if HistPrecipitation.daily.precipitation_sum[3] <= 2 then "💦" else "🌧️" endif, HistPrecipitation.daily.precipitation_sum[3]) + format( "Dia {0} {1} {2:4.1f}mm ", substr(HistPrecipitation.daily.time[2],8,2), if HistPrecipitation.daily.precipitation_sum[2] <= 2 then "💦" else "🌧️" endif, HistPrecipitation.daily.precipitation_sum[2]) + format( "Dia {0} {1} {2:4.1f}mm ", substr(HistPrecipitation.daily.time[1],8,2), if HistPrecipitation.daily.precipitation_sum[1] <= 2 then "💦" else "🌧️" endif, HistPrecipitation.daily.precipitation_sum[1]) + format( "Dia {0} {1} {2:4.1f}mm ", substr(HistPrecipitation.daily.time[0],8,2), if HistPrecipitation.daily.precipitation_sum[0] <= 2 then "💦" else "🌧️" endif, HistPrecipitation.daily.precipitation_sum[0])
Reading the manual, I understood that it could be something with each, but I couldn't create the expression.
Please, your help.
Thanks.
-
wow. Nobody from the community chiming in on this part? What happened to all my expression experts? Sigh...
each
- range operator
-
Super!! The comment "range operator" opened a window for me
I didn't know about this facility.
join((each i in 6..0 : format( "Dia {0} {1} {2:4.1f}mm ", substr(HistPrecipitation.daily.time[i],8,2), if HistPrecipitation.daily.precipitation_sum[i] <= 2 then "💦" else "🌧️" endif, HistPrecipitation.daily.precipitation_sum[i])), " ")
THANK YOU A LOT!!!
-
Awesome! Well done!
-
T toggledbits locked this topic on