SiteMap Visibility comparing 2 Number Items

I’m trying to show a button on my sitemap that will check my CurrentOH build to the latest on CloudBees, but can’t seem to get it show correctly.

I am currently on Build 1115, same as what cloudbees shows.

If I compare either item on its own to number 1115, the item becomes visible on the sitemap, so both of these work.

Switch item=OH_Upgrade mappings=[ON="Run Upgrade"] visibility=[OH_CurrentBuild == 1115]
Switch item=OH_Upgrade mappings=[ON="Run Upgrade"] visibility=[OH_LatestBuild == 1115]

Yet, comparing the 2 item values to each other does not work?

Switch item=OH_Upgrade mappings=[ON="Run Upgrade"] visibility=[OH_CurrentBuild == OH_LatestBuild]

Yes, this is correct. Sitemap properties only do work to constant values. If you want to compare to variable values, you have to use a rule:

Number OH_CurrentBuild {...}
Number OH_LatestBuild {...}
Switch OH_upgradeable //No binding


rule "set OH_upgradeable"
    Item OH_LatestBuild changed
    if((OH_LatestBuild instanceof DecimalType) && (OH_CurrentBuild instanceof DecimalType))
        if((OH_LatestBuild.state as DecimalType) > (OH_CurrentBuild.state as DecimalType))

and then in the sitemap

Switch item=OH_Upgrade mappings=[ON="Run Upgrade"] visibility=[OH_upgradeable == ON]

Thanks, that worked out well.

Working from the info here, I’m close now to being able to check and upgrade OH2 from a sitemap.