[SOLVED] Using previousstate in Sitemap?

Hello,

i read the following lines in the sitemap-documentation and got a questions:

The comparison operators for labelcolor and valuecolor are the same as for the visibility parameter.

Examples:

The following three lines are equivalent.

Text item=Temperature labelcolor=[>0="blue"] valuecolor=[22="green"]
Text item=Temperature labelcolor=[>0="blue"] valuecolor=[==22="green"]
Text item=Temperature labelcolor=[>0="blue"] valuecolor=[Temperature==22="green"]

The line below illustrates the importance of operator order:

Text item=Temperature valuecolor=[Last_Update=="Uninitialized"="gray",
                                  >=25="orange", >=15="green", 0="white", <15="blue"]

Note that expressions are evaluated from left to right; the first matching expression determines the color. If the order of the expressions was reversed, the color assignment would not work properly. Note also, the effect of omitting Temperature and the comparison operator in the expression 0="white" (as compared to ==0="white").

Is it also possible to use the previousstate in sitemaps in order to color the text f.e. red if the previous value was higher than the actual value oder green if the prev. value was lower?

thanks for help,
Alex

Sadly this is not possible directly (would have been a nice feature, indeed!). You can, however, solve this by going through an extra item and a rule…

Only if you save the previous state in another Item. Then you can use that Item in the comparison the same way that the Last_Update Item is being used to change the color of Temperature in the last quoted example. You will need a Rule to populate the previous state Item. Something like:

rule "Temperature previous state"
when
    Item Temperature changed
then
    Previous_Temp.postUpdate(previousState)
end

thank you both for fast reply!