Hex-String to text DCI transformation

Started by yordi, December 18, 2019, 12:11:13 PM

Previous topic - Next topic

yordi

Hi,

With a DCI i get a Hex-string  "56 4E 42 51 44 39 4B 30 59 46"
Online i can let it translate to text ( https://coding.tools/hex-to-ascii ) , then i get "VNBQD9K0YF" This is a serial number of a printer.

Ho knows the Netxms scripting language to use in de transformation part of the DCI to get this Hex-string transformed to text in Netxms?

Greetings

Victor Kirhenshtein

Hi,

this script will transform first argument from hex string (space separated) into text:

l = length($1);
out = "";
for(i = 1; i < l; i += 3)
out .= chr(x2d(substr($1, i, 2)));
return out;


You should be able to use it as is in DCI transformation.

Best regards,
Victor

yordi