iostreamz
(iostreamz)
January 3, 2019, 7:05pm
1
Greetings all,
I have noticed that some items and sitemap entries require a “[%s]” be added in the label section for it to work properly.
Can someone please explain when it is required and when it is not required as I have not been able to figure it out.
Thanks !
RolfV
(Rolf Vermeer)
January 3, 2019, 8:07pm
2
For this occasion I’m just referring to a post I made earlier today:
What you are asking about is called String formatting. For example:
[%.1f °C]: %.1f means that at that point a floating point number is to be filled in, with 1 digit after the decimal separator (the .), followed by the unit degrees Celcius in this case, but that could be anything.
[%d %%]: %d means that a integer number is to be filled in there, and it should be followed by a percentage sign (%), but as the % is already a special character, it is escaped by adding another % in front of it.
[%…
mstormi
(Markus Storm)
January 3, 2019, 8:11pm
3
%s displays the item value as a string (which only makes sense for string-type items).
It isn’t required but the only way to display the value in a sitemap (else it’s just displaying the rest as static text).
label= in sitemaps overrides what is set in the item definition, so you can do it there, too.
1 Like
iostreamz
(iostreamz)
January 5, 2019, 1:02am
4
This answers my question, thank you both.
mstormi
(Markus Storm)
January 5, 2019, 10:21am
5
Tick the solution checkmark please for others to find this thread.