Kodi Community Forum

Full Version: Trying to compare numbers to show specific text
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone. I'm trying to show the number of unwatched episodes if there are any, and if there aren't any then I want to show nothing.

I'm not sure if I'm doing it right though. Well obviously I'm not or I wouldn't be here.

I have a variable in one xml liek this:

Code:
<variable name="ShowUnwatched">
    <value condition="gt(ListItem.Property(UnWatchedEpisodes),0)">$INFO[ListItem.Property(UnWatchedEpisodes)] $LOCALIZE[16101]</value>
    <value></value>
</variable>

And then I'm using that variable for a label like so:

Code:
<label>$VAR[ShowUnwatched]</label>

It only shows the blank though and never the number of unwatched episodes. Is this an incorrect way of using the compare functions?

Ok, I tried using StringCompare instead with this:

Code:
<variable name="ShowUnwatched">
    <value condition="!StringCompare(ListItem.Property(UnWatchedEpisodes),0)">$INFO[ListItem.Property(UnWatchedEpisodes)] $LOCALIZE[16101]</value>
    <value></value>
</variable>

And that worked so I guess that means the returned value from Property(UnWatchedEpisodes) is a string and not a number... weird... except that the top item that says "up one level" also now has the "unwatched" text which I of course don't want. Any idea how to fix that?