<?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[FindNodeObject not working (for me)]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I am using 1.0.1.</p>
<p dir="auto">I found the following post very helpful,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/victor" aria-label="Profile: victor">@<bdi>victor</bdi></a> said in <a href="/post/3994">Action to return value</a>:</p>
<blockquote>
<p dir="auto">In 1.0.0-rc1 I have added new NXSL function FindNodeObject. It takes two arguments: current node object and ID or name of node of interest. It can be used as following:</p>
<pre><code>sub main()
{
   // Search for node named "gateway"
   gw_node = FindNodeObject($node, "gateway");

   if (gw_node == null)
      return 0;   // No such node or access denied

   // from here, gw_node can be used in a same way as $node, for example:
   status = GetDCIValue(gw_node, FindDCIByDescription(gw_node, "Status"));

   return 1;
}
</code></pre>
</blockquote>
<p dir="auto">I have tried doing this with the following code,</p>
<p dir="auto">server_name = "" . plaza . ".se"; // this gives me the server name in the var, as this is different depending on which node that the DCI is running on<br />
server_name_node = FindNodeObject($node, server_name);<br />
return server_name_node;</p>
<p dir="auto">This only gives me "null" which would indicate that the server with the server_name is non-existant.<br />
But I have also set the node name manually, instead of using the var, which works as it should, but this means a lot of manual work and a generated name in a var is much more flexible <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">So my question is, is there something I am missing, or is it just not possible to use the variable instead of a static argument?</p>
<p dir="auto">Best regards,<br />
Dan</p>
]]></description><link>https://forum.netxms.org/topic/940/findnodeobject-not-working-for-me</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 07:41:17 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/940.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 Jun 2010 02:29:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to FindNodeObject not working (for me) on Sun, 27 Jun 2010 13:27:23 GMT]]></title><description><![CDATA[<p dir="auto">I thought I could share the result.</p>
<pre><code>sub main() {
   numImages = $1;
   if ($node-&gt;name ~= "^(.*)ru[rf]([0-9]{2})1") {
      plaza = $1;
      lane = int64($2);
   }
   mlc = plaza . "mlc010";
   mlcNode = FindNodeObject($node, mlc);
   dciName = "Total number of transactions in Lane " . lane;
   numTransactions = GetDCIValue(mlc_node, FindDCIByDescription(mlcNode,dciName));
   return (numImages / numTransactions) * 100;
}
</code></pre>
<p dir="auto">Best regards,<br />
Dan</p>
]]></description><link>https://forum.netxms.org/post/4297</link><guid isPermaLink="true">https://forum.netxms.org/post/4297</guid><dc:creator><![CDATA[Dan]]></dc:creator><pubDate>Sun, 27 Jun 2010 13:27:23 GMT</pubDate></item><item><title><![CDATA[Reply to FindNodeObject not working (for me) on Sat, 26 Jun 2010 23:55:00 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">Hm ok, strange.<br />
But it works now, so maybe it was just the good ol' user error <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Thanks for your help though!</p>
<p dir="auto">Best regards,<br />
Dan</p>
]]></description><link>https://forum.netxms.org/post/4296</link><guid isPermaLink="true">https://forum.netxms.org/post/4296</guid><dc:creator><![CDATA[Dan]]></dc:creator><pubDate>Sat, 26 Jun 2010 23:55:00 GMT</pubDate></item><item><title><![CDATA[Reply to FindNodeObject not working (for me) on Sat, 26 Jun 2010 22:05:03 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">You code was correct, it's very strange that it was not working. Adding an empty string should not change result. I suspect bug in NXSL interpreter, but I was unable to reproduce this on my test system - both</p>
<p dir="auto">server_name = "" . plaza . ".se";</p>
<p dir="auto">and</p>
<p dir="auto">server_name = plaza . ".se";</p>
<p dir="auto">gives the same correct result in my test script.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/4295</link><guid isPermaLink="true">https://forum.netxms.org/post/4295</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Sat, 26 Jun 2010 22:05:03 GMT</pubDate></item><item><title><![CDATA[Reply to FindNodeObject not working (for me) on Sat, 26 Jun 2010 17:36:08 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">The plaza variable is created like this,</p>
<pre><code>if ($node-&gt;name ~= "^(.*)ru[rf]([0-9]{2})1") {
	plaza = $1;
	lane = int64($2);
}
</code></pre>
<p dir="auto">I just tried changing the creation of the variable "server_name" from,</p>
<pre><code>server_name = "" . plaza . ".se";
</code></pre>
<p dir="auto">to,</p>
<pre><code>server_name = plaza . ".se";
</code></pre>
<p dir="auto">And now the following creates a node object,</p>
<pre><code>server_name_node = FindNodeObject($node, server_name);
</code></pre>
<p dir="auto">It does work now, it seems like it was my creation of the variable "server_name" that was the problem.<br />
So I guess it was my bad code that just didn't work <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Thank you for the feedback!</p>
<p dir="auto">But, now when I test the script the console application dies</p>
<pre><code>NETXMS CONSOLE CRASH DUMP
Sat Jun 26 19:30:54 2010

EXCEPTION: C0000005 (Access violation) at 76EB1FFE

NetXMS Console Version: 1.0.1
OS Version: Windows NT 6.1 Build 7600
Processor architecture: Intel x86

Register information:
  eax=00000138  ebx=0012DE20  ecx=00720000  edx=0012DE20
  esi=2AA7F833  edi=0012DE18  ebp=02A9FEEC  esp=02A9FEB8
  cs=001B  ds=0023  es=0023  ss=0023  fs=003B  gs=0000  flags=00010206

Call stack:
  [ntdll:76EB1FFE]: RtlFreeHeap
  [ntdll:76EB1FAF]: RtlFreeHeap
  [MSVCRT:756598CD]: free
  [nxcon:0040B323]: (function-name not available)
  [kernel32:75AF1174]: BaseThreadInitThunk
  [ntdll:76EBB3F5]: RtlInitializeExceptionChain
  [ntdll:76EBB3C8]: RtlInitializeExceptionChain
</code></pre>
<p dir="auto">Adding the .mdmp file.</p>
<hr />
<p dir="auto"><a href="/assets/uploads/files/smf/0000000000358-nxcon-2804-1277573454.mdmp">nxcon-2804-1277573454.mdmp</a></p>
]]></description><link>https://forum.netxms.org/post/4294</link><guid isPermaLink="true">https://forum.netxms.org/post/4294</guid><dc:creator><![CDATA[Dan]]></dc:creator><pubDate>Sat, 26 Jun 2010 17:36:08 GMT</pubDate></item><item><title><![CDATA[Reply to FindNodeObject not working (for me) on Sat, 26 Jun 2010 14:37:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">You use variable <em>plaza</em> in your code, but how you initialize it? If you wish to use something based on DCI's node, the only way to access node's attributes is via $node variable. So, for example, if you wish to add "-server" suffix to current node's name and find that node, you should use code like this:</p>
<pre><code>server = FindNodeObject($node, $node-&gt;name . "-server");
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/4293</link><guid isPermaLink="true">https://forum.netxms.org/post/4293</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Sat, 26 Jun 2010 14:37:56 GMT</pubDate></item></channel></rss>