RE: transformation script example

From: Victor Kirhenshtein <victor_at_DOMAIN_REMOVED>
Date: Thu, 28 Dec 2006 00:15:10 +0200

Hello!
 
 Yes, "Test" button doesn't work. Transformation scripts are fully
functional, they should be written in simple embedded language called
NXSL - NetXMS Scripting Language. Script could be either a single
expression or a complete function - for transformations most likely you
will use first form. In documentation you can find formal grammar of
NXSL, and below are some examples of transformation scripts:
 
1. Divide input value by 1024:
 
$1 / 1024
 
or in full form:
 
sub main()
{
   return $1 / 1024;
}
 
2. Convert numerical values 1, 2, 3 to text values OK, Error, Unknown:
 
sub main()
{
   if ($1 == 1)
      return "OK";
   if ($1 == 2)
      return "Error";
   if ($1 == 3)
      return "Unknown";
   return "BAD DATA";
}
 
3. Get absolute value of source data:
 
abs($1)
 
 
As you can see, syntax is more or less like C. You can use variables,
they not need to be defined. Data types are automatic, so expression 1 +
"2" is valid and result will be 3 (or "3" in string form). Please note
that short form doesn't have trailing semicolon - it's important. $1 is
a parameter number one, in case of transformation script it's source
data.
 
Best regards,
Victor

        -----Original Message-----
        From: Edgar Chupit [mailto:chupit_at_gmail.com]
        Sent: Wednesday, 27 December, 2006 21:00
        To: NetXMS Users
        Subject: [netxms-users] transformation script example
        
        
        Dear Users,
        
        Unfortunately I have not found any examples of transformation
script in manual. When I enter anything in Data Collection Item ->
Transformation -> Transformation Script and press "Test" button, nothing
happens, so I suppose that "Test" button doesn't work. What about
transformation script itself, is it implemented feature? If so, can
anybody provide simple working example of transformation function.
        
        Thank you!
        
        --
        Best regards,
        Edgar Chupit
        callto://edgar.chupit
Received on Thu Dec 28 2006 - 00:15:10 EET

This archive was generated by hypermail 2.2.0 : Thu Dec 28 2006 - 00:26:48 EET