NetXMS Support Forum

English Support => General Support => Topic started by: lindeamon on February 12, 2016, 12:58:11 PM

Title: Transformation Script
Post by: lindeamon on February 12, 2016, 12:58:11 PM
Hi,

i found myself spending an hour trying to figure out what went wrong in this simple transform script:
sub Main()
{
return ($1 / 1024 / 1024 / 1024) . " GB";
}

I came to the understanding the i can not use "Main" and i have to use "main" and i can not use any other name.
did i understood it correctly ?

10x,
Lindeamon
Title: Re: Transformation Script
Post by: Victor Kirhenshtein on February 12, 2016, 01:29:24 PM
Hi,

you have to use main (lowercase) or not use main function at all. Correct script would be

return ($1 / 1024 / 1024 / 1024) . " GB";

or

sub main()
{
   return ($1 / 1024 / 1024 / 1024) . " GB";
}

Best regards,
Victor
Title: Re: Transformation Script
Post by: tomaskir on February 12, 2016, 02:48:32 PM
For anyone looking at this in the future, this also describes how script entry works:
https://wiki.netxms.org/wiki/UM:NetXMS_Scripting_Language_(NXSL)#Script_entry_point
Title: Re: Transformation Script
Post by: lindeamon on February 14, 2016, 10:01:23 AM
thank you all.

Victor,
it will be great if something like that will be in the "hint".
since i am doing little scripting and not very often, i forget this kind of things and i find my self struggling with the "help".

thank you very much,
Lindeamon