Is it possible to count all the child elements directly under an icon? All types of child elements should be considered (devices and groups).
Article Comments
Thanks for your response.
However with this approach, we have to create an additional sensor for the counting on each of the affected groups and we lose the status color of the group on the icon.
Based on your suggestions, I have implemented this using jQuery code in the icon template:
<span id="count<@objectid>"/> <script> $(document).ready(function(){ $.get("https://yourserver/api/table.xml?content=sensortree&id=<@objectid>", function(data) { $('#count<@objectid>').text($('sensortree > nodes > :first-child > :has(*)', data).length); }); }); </script>
Apr, 2015 - Permalink
I guess your best starting point is the table.xml API call
You can limit the result set by including the objectID of the parent 'icon'
'Feeding' the url above to the HTTP XML/Rest Value Sensor using XPath query sensortree/nodes/*[1] and selecting Count Child Nodes will give you the number of child elements +7
The +7 is caused by the additional describing nodes (<name>,<id>,<url>,...) in the xml result.
You might be able to filter out these additional nodes using a more advanced XPath query.
Apr, 2015 - Permalink