Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Script size limitations, and calling a script from another script.

Script size limitations, and calling a script from another script.

Scheduled Pinned Locked Moved Support
5 Posts 2 Posters 8.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    S
    SteveK
    wrote on last edited by
    #1

    Hi All,

    I am trying to display a message in response to a SNMP trap that has 200+ Emums (using a case statement in a script), and there seems to be a limitation to the numbers of lines that a script allows. It allows me to add all the lines in the script editor, but when I save the script, it seems to get cut short.

    In an attempt to get around this I thought that I may be able to split it up into 2 separate scripts, and call them from another script. I have done some basic testing, I cannot seem to be able to call a script from another script.

    Can someone please advise if it is possible to call a script from another script, and if so, the syntax.

    Also is there some way the database can be modified to allow longer scripts?

    Many thanks.

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      Hello!

      It's very strange - there are no size limitation on scripts. What database you are using?

      To call one script from another, called script must be in script library, and contain function(s) other than main(). Then in calling script you should add use statement, for example:

      script in library, called my_script:

      sub my_function()
      {
         return "some value";
      }
      

      script in event processing policy:

      use my_script;
      
      sub main()
      {
         value = my_function();
         // some further processing
      }
      

      Best regards,
      Victor

      1 Reply Last reply
      0
      • S
        S
        SteveK
        wrote on last edited by
        #3

        Hi Victor,

        Thank you for your swift response. I am using SQL 2005, and the field "script_code" is data type "text".

        The script had 5547 characters, and when saved, it chopped off after 3591 characters.

        In your example, you mention the calling script in event processing policy. Can this be another script in library?

        Kind Regards,
        Steve...

        1 Reply Last reply
        0
        • V
          V
          Victor Kirhenshtein
          wrote on last edited by
          #4

          Hi!

          Yes, you can call library script from another library script in a same way.

          I'll check script saving in MS SQL a bit later.

          Best regards,
          Victor

          1 Reply Last reply
          0
          • S
            S
            SteveK
            wrote on last edited by
            #5

            Thanks Victor,

            That worked. Your help is much appreciated.

            Kind Regards,
            Steve...

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            Powered by NodeBB Contributors
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups