<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[SOLVED] format string in DCI Container not working]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">This is my first post, so I hope I am clear.</p>
<p dir="auto">I having problems with formatting the DCI Containers on a network map. Running NetXMS 2.2.10 on Ubuntu.</p>
<p dir="auto">I am reading these:</p>
<ol>
<li><a href="https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax" rel="nofollow ugc">https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax</a></li>
<li><a href="https://track.radensolutions.com/issue/NX-501" rel="nofollow ugc">https://track.radensolutions.com/issue/NX-501</a></li>
<li><a href="https://www.netxms.org/documentation/adminguide/visualisation.html?highlight=visual" rel="nofollow ugc">https://www.netxms.org/documentation/adminguide/visualisation.html?highlight=visual</a></li>
</ol>
<p dir="auto">It seems that most common formatters would include:<br />
    %s - insert a string<br />
    %d - insert a signed integer (decimal)<br />
    %f - insert a real number, standard notation</p>
<p dir="auto">And we can see from the documentation:</p>
<blockquote>
<p dir="auto">For each Data Source can be configured: Data collection item, name, format string(like “Text: %.4f”), in case of table DCI also column and instance</p>
</blockquote>
<p dir="auto">So, my problem is that if I select a DCI, the Map displays the integer with 6 decimal places, and I want to reduce that to two. However ANY format string items do not work.</p>
<p dir="auto">E.g. putting the suggested %.4f returns an &lt;INVALID FORMAT&gt; (%.4f), using %d returns the same. Switching the DCI itself between string and integer makes no difference.</p>
<p dir="auto">Please can somebody help me understand what I an doing wrong?</p>
<p dir="auto">Many thanks.</p>
<p dir="auto">Alex</p>
]]></description><link>https://forum.netxms.org/topic/5775/solved-format-string-in-dci-container-not-working</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 16:56:34 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/5775.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Dec 2018 17:21:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED] format string in DCI Container not working on Tue, 01 Jan 2019 19:27:28 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">Thanks for all the feedback.</p>
<p dir="auto">My problem was (of course) entirely my mistake.</p>
<p dir="auto">I did not understand the difference between integer and Floating Point data type. An integer is just that, a whole number and so cannot get decimal places.</p>
<p dir="auto">So trying to use %.2f format string with integer cant work. I Changed my DCIs to Floating point, and now %.2f for 2 decimal places is working fine.</p>
<p dir="auto">Apologies to all.</p>
<p dir="auto">Alex</p>
]]></description><link>https://forum.netxms.org/post/25159</link><guid isPermaLink="true">https://forum.netxms.org/post/25159</guid><dc:creator><![CDATA[alexrhyshurn]]></dc:creator><pubDate>Tue, 01 Jan 2019 19:27:28 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] format string in DCI Container not working on Tue, 01 Jan 2019 07:56:06 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am sorry I was not clear.</p>
<p dir="auto">The returned value for %s is, for example, 109.794250 plain and simple.</p>
<p dir="auto">In the format string I have put %s kW so giving the result of 109.794250 kW</p>
<p dir="auto">If I create a new DCI COntainer and leave the format string blank it returns: 109.794250<br />
If I create a new DCI COntainer and put %s in the format string it returns: 109.794250</p>
<p dir="auto">I can use any text around the %s such as Total Grid Power: %s kW which returns: Total Grid Power: 109.794250 kW</p>
<p dir="auto">What I want to do is take the result from %s and reduce it to two decimal places.</p>
<p dir="auto">So I don't think that its a string.</p>
<p dir="auto">Best regards,</p>
<p dir="auto">Alex</p>
]]></description><link>https://forum.netxms.org/post/25158</link><guid isPermaLink="true">https://forum.netxms.org/post/25158</guid><dc:creator><![CDATA[alexrhyshurn]]></dc:creator><pubDate>Tue, 01 Jan 2019 07:56:06 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] format string in DCI Container not working on Mon, 31 Dec 2018 12:02:02 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">am I understood correctly that actual returned value contains floating point number and text "kW"? If yes, Java consider it as string and do not allow numeric formatting. You can change DCI data type to floating point number and use transformation script to remove unit indicator, like this:</p>
<pre><code>if ($1 ~= "([0-9.]+) kW")
   return $1;
return $1;
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/25157</link><guid isPermaLink="true">https://forum.netxms.org/post/25157</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 31 Dec 2018 12:02:02 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] format string in DCI Container not working on Thu, 27 Dec 2018 13:04:20 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Thanks for the response.</p>
<p dir="auto">The DCI is a simple query an SNMP value (no transformations or anything) from a Schneider Powerlogic ION Power Meter, and the Map is a DCI Container, I have shown the raw value as well as some others with format string. I am aiming to get 2 deminal places precision.</p>
<p dir="auto">I should add, that the DCI containers shown with data are using %s</p>
<p dir="auto">Thanks,</p>
<p dir="auto">Alex</p>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000004317-LV0_Power_meter_DCI_Forum.png" alt="LV0_Power_meter_DCI_Forum.png" class="img-markdown  img-fluid" width="1092" height="904" /></p>
<p dir="auto"><img src="/assets/uploads/files/smf/0000000004319-network_map_forum.png" alt="network_map_forum.png" class="img-markdown  img-fluid" width="999" height="517" /></p>
]]></description><link>https://forum.netxms.org/post/25145</link><guid isPermaLink="true">https://forum.netxms.org/post/25145</guid><dc:creator><![CDATA[alexrhyshurn]]></dc:creator><pubDate>Thu, 27 Dec 2018 13:04:20 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] format string in DCI Container not working on Thu, 27 Dec 2018 09:18:12 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">could you post your DCI configuration and some actual values?</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/25142</link><guid isPermaLink="true">https://forum.netxms.org/post/25142</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 27 Dec 2018 09:18:12 GMT</pubDate></item></channel></rss>