It appears that Calc measures fail when the formula contains a large number of nested conditional statements.
I have noticed the problem in the past but had forgotten about it until this topic was posted. This appeared to have a similar issue.
Attached is the code from that topic along with an edited version of the CALC measure using less nested conditionals. While the measure with less works fine, the one with lots returns 0 no matter what the input value is.
I am running the latest 1.2 r340 x64 version but i have experienced it in previous build as well
It is currently May 1st, 2024, 9:23 am
Limit on Nested Conditional
-
- Developer
- Posts: 318
- Joined: July 14th, 2009, 5:57 pm
Limit on Nested Conditional
You do not have the required permissions to view the files attached to this post.
+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
Quis custodiet ipsos custodes?
-
- Developer
- Posts: 263
- Joined: July 31st, 2009, 2:23 pm
- Location: Tokyo, JPN
Re: Limit on Nested Conditional
Apparently, as for the nest which can be included in one expression, nine sets seem to be a limit. So probably If you need any more expression, you would have to break up a operator into several measure.
For instance, if I use your example...
For instance, if I use your example...
Code: Select all
[Rainmeter]
Update=1000
[MeasureYahooWeather]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=http://weather.yahooapis.com/forecastrss?p=GMXX0050&u=c
RegExp=(?siU)speed=\"(.*)\".*speed=\"(.*)\"
StringIndex=1
UpdateRate=1800
Debug=1
[MeasureSpeed]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureYahooWeather]
StringIndex=1
Substitute="km/h":"666";"mph":"668"
[MeasureWindSpeed]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureYahooWeather]
StringIndex=2
[MeasureWindSpeedBft]
Measure=Calc
Formula=((MeasureWindSpeed > 118) ? 12 : ((MeasureWindSpeed > 103) ? 11 : ((MeasureWindSpeed > 89) ? 10 : ((MeasureWindSpeed > 75) ? 9 : ((MeasureWindSpeed > 62) ? 8 : ((MeasureWindSpeed > 50) ? 7 : ((MeasureWindSpeed > 39) ? 6 : ((MeasureWindSpeed > 29) ? 5 : ((MeasureWindSpeed > 20) ? 4 : MeasureWindSpeedBft2)))))))))
[MeasureWindSpeedBft2]
Measure=Calc
Formula=((MeasureWindSpeed > 12) ? 3 : ((MeasureWindSpeed > 6) ? 2 : ((MeasureWindSpeed > 1) ? 1 : 15)))
[MeterResult]
Meter=STRING
MeasureName=MeasureWindSpeedBft
;MeasureName2=MeasureWindSpeedTest
X=0
Y=0
W=500
H=40
FontFace=Segoe UI
FontSize=23
FontColor=255,255,255,255
AntiAlias=1
;Text="%1 -- %2"
-
- Developer
- Posts: 318
- Joined: July 14th, 2009, 5:57 pm
Re: Limit on Nested Conditional
Yeah nine is about what I was finding as well.
Thats a good idea for a workaround though, thanks
Thats a good idea for a workaround though, thanks
+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
Quis custodiet ipsos custodes?
-
- Posts: 22
- Joined: December 2nd, 2009, 7:05 pm
Re: Limit on Nested Conditional
The workaround also works for variables used in for example x/y formulas:
Code: Select all
[Rainmeter]
Update=1000
[Variables]
Variable=10
CTest2=((#Variable#=10)?(51):(0))
CTest1=((#Variable#=1)?(6):((#Variable#=2)?(11):((#Variable#=3)?(16):((#Variable#=4)?(21):((#Variable#=5)?(26):((#Variable#=6)?(31):((#Variable#=7)?(36):((#Variable#=8)?(41):((#Variable#=9)?(46):(#CTest2#))))))))))
[Meter1]
Meter=Image
SolidColor=255,255,255,200
W=5
H=5
X=0
Y=0
LeftMouseDownAction=!RainmeterRefresh
[Meter2]
Meter=Image
SolidColor=255,255,255,200
W=5
H=5
X=#CTest1#
Y=0
LeftMouseDownAction=!RainmeterRefresh