[SOLVED] Sitemap visibility comparison to internal variable

Hi,
I would prefer to display some sitemap rows only if visibility = internal.var.status as number.
Comparison to constant is working well.
visibility=[Usercode==1111]

I prefer to define only once some internalvar, common used for visibility comparison.
visibility=[Usercode==internalvar.state as number]

Thanks.

visibility=

You can compare to an item’s state
You can’t compare to a variable
Use a dummy item instead of a variable

No, you can’t. You may compare 1 item to a constant, not 1 item to another item.

I beg to differ:

Text myItem visibility=[myOtherItem>30, AnotherItem=="SomeString"]

@vzorglub, that’s no difference to what i wrote.

You can’t compare item with item, you just can compare one item to a constant. You are just doing the item to constant comparison multiple times.

The following does not work:

Text myItem visibility=[myOtherItem<anotherItem, anotherItem2==anotherItem3]

And that’s the comparison the OP wants.

I’ve already been there:

Yes sorry.
You can set the visibility according to another item but not comparing to another item.
There is a workaround though
You need a proxy item:

items

Number myItem
Switch myItem_Visibility

rule

rule "myItem Visibility"
when
    Item myItem changed
then
    if (myItem.state >= someVariable) {
        myItem_Visibility.postUpdate(ON)
    } else {
        myItem_Visibility.postUpdate(OFF)
    }
end

sitemap

Text myItem visibility=[myItem_Visibility==ON]

Did that solve your problem?
If yes, please mark the thread as solved, thanks