Transformation Script

Started by lindeamon, February 12, 2016, 12:58:11 PM

Previous topic - Next topic

lindeamon

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

Victor Kirhenshtein

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

tomaskir

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

lindeamon

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