Kodi Community Forum
Trying to compare numbers to show specific text - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Skins Support (https://forum.kodi.tv/forumdisplay.php?fid=67)
+---- Forum: Confluence (https://forum.kodi.tv/forumdisplay.php?fid=125)
+---- Thread: Trying to compare numbers to show specific text (/showthread.php?tid=200072)



Trying to compare numbers to show specific text - kamcknig - 2014-07-17

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?