xenium wrote:Hello again
I found a code that counts the time left until sunset and sunrise.
I tried to adapt it to my code but it does not work.
What is wrong ?
Nothing. Does work for me.
One small thing I had to adjust. In the Formula option of the [MeasureCurrent] measure, I replaced the MeasureMin measure name with MeasureMinute (I have this measure name):
Code: Select all
[MeasureCurrent]
Measure=Calc
Formula=( 60 * MeasureHour + MeasureMinute )
Check your code, to see how that measure is named.
After this adjustment, the [MeasureToSunrise] and [MeasureToSunset] measures are returning the number of minutes to the sunrise and sunset of today (after sunrise, the [MeasureToSunrise] measure returns a negative number, which is perfectly ok - today's sunrise already has passed).
The [MeasureLeft] measure are returning the number of minutes up to the appropriate moment (sunrise or sunset, which is the next one).
Finally the [MeasureLeftHours] and [MeasureLeftMin] measures are returning the number of left hours and minutes respectively. The hour and min variables are set up by the IfTrueAction and IfFalseAction options of these two measures. Here again one small error I found: there is an extra bracket after the
IfConditionMode=1 option of the [MeasureLeftMin] measure.
Additionally just mention that I think those
IfConditionMode=1 options are useless. I'd remove them.
If you can't get it to work properly, please post again the whole code.