<?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[Transforming a value to string to use in custom error message]]></title><description><![CDATA[<p dir="auto">Current I report the current value of the DCI using the %&lt;currentValue&gt;<br />
For the ServiceCheck.HTTP the value can be 0 to 3.<br />
I would rather have a textual description instead of the numerical value. I thought of using a the transformation script but this will change the type from int to string which cannot be graphed.<br />
Another place where I could do this is in the filtering script where CUSTOM_MESSAGE can be set.</p>
<p dir="auto">sub main()<br />
{<br />
 CUSTOM_MESSAGE = "";<br />
 <br />
 if($1-&gt;value == 2)<br />
 {<br />
   CUSTOM_MESSAGE = "cannot connect to server";<br />
 }<br />
 else<br />
 if($1-&gt;value == 3)<br />
 {<br />
   CUSTOM_MESSAGE = "content of does not match";<br />
 }</p>
<p dir="auto">  return true;<br />
}</p>
<p dir="auto">How do I test the “value” within the filtering script ($1-&gt;value above does not work of course) ?<br />
Or maybe there's a better solution?</p>
<p dir="auto">Regards,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/topic/1566/transforming-a-value-to-string-to-use-in-custom-error-message</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 09:04:48 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/1566.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 17 Jan 2012 11:43:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Transforming a value to string to use in custom error message on Tue, 17 Jan 2012 15:23:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi Victor,</p>
<p dir="auto">Your solution is elegant and works like a charm. Tanks!</p>
<p dir="auto">Kind regards,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/post/6774</link><guid isPermaLink="true">https://forum.netxms.org/post/6774</guid><dc:creator><![CDATA[DanG]]></dc:creator><pubDate>Tue, 17 Jan 2012 15:23:51 GMT</pubDate></item><item><title><![CDATA[Reply to Transforming a value to string to use in custom error message on Tue, 17 Jan 2012 13:33:59 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I would suggest calling a script from macro, like this:</p>
<ol>
<li>Create script called "ServiceStateName" in script library:</li>
</ol>
<pre><code>state = GetEventParameter($event, "currentValue");
switch(state)
{
   case 0:
      return "OK";
   case 1:
      return "error in parameters";
   case 2:
      return "cannot connect to server";
   case 3:
      return "content of does not match";
}
return "UNKNOWN";
</code></pre>
<ol start="2">
<li>Use %[ServiceStateName] instead of %&lt;currentValue&gt;</li>
</ol>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/6773</link><guid isPermaLink="true">https://forum.netxms.org/post/6773</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 17 Jan 2012 13:33:59 GMT</pubDate></item></channel></rss>