Whoops. No sooner did I hit "send" than I forgot that you can't take differences of ValueHelpers. So, the example becomes
#set $prevValue = None #for $hour in $day.hours Current value = $hour.outTemp #slurp # if $prevValue is not None Difference from previous value = $($hour.outTemp.raw - $prevValue) # else N/A # end if #set $prevValue = $hour.outTemp.raw #end for As I said, it's not tested! -tk On Mon, Mar 19, 2018 at 9:53 AM, Thomas Keffer <[email protected]> wrote: > Hello, Walt > > Unfortunately, I can't think of a way to do that. > > You could simulate it by iterating over 24 hours, then taking the > difference from the value of the previous hour. Something like (NOT TESTED): > > #set $prevValue = None > > #for $hour in $day.hours > Current value = $hour.outTemp #slurp > # if $prevValue is not None > Difference from previous value = $($hour.outTemp - $prevValue) > # else > N/A > # end if > #set $prevValue = $hour.outTemp > #end for > > See the Cheetah User's Guide > <http://cheetahtemplate.org/users_guide/output.html> for nuances on the > Cheetah template library (such as the #slurp directive above). > > -tk > > On Mon, Mar 19, 2018 at 8:48 AM, Walter Smith <[email protected]> wrote: > >> Hi I am new, I searched previous posts and didn't see an answer for this. >> >> I want to modify a report template to show the hourly readings for the >> last 24 hours. And the changes by hour. >> >> Can the $trend tag be used in any way with the $hour tag? Like >> >> $hour($hours_ago=$xxx).outTemp.last.trend >> >> or >> >> $trend.$hour($hours_ago=$xxx).outTemp.last >> >> Thanks, >> >> Walt >> >> -- >> You received this message because you are subscribed to the Google Groups >> "weewx-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
