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. if statement

if statement

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 23.8k 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.
  • L
    L
    lindeamon
    wrote on last edited by
    #1

    hi,

    i am trying to right a very simple transform script which will take the $1 variable and change it's value to "yes" if it is equal to 1 and "no" if it is equal to 2.
    i can get through the first comparison but other then that nothing works and the user manual does not help.

    10x,
    lindeamon

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

      Hi!

      Script for this cold looks like following:

      if ($1 == 1)
         return "yes";
      if ($1 == 2)
         return "no";
      return "neither_yes_or_no";
      

      or, using switch operator:

      switch($1)
      {
         case 1:
            return "yes";
         case 2:
            return "no";
         default:
            return "neither_yes_or_no";
      }
      

      Best regards,
      Victor

      1 Reply Last reply
      0
      • L
        L
        lindeamon
        wrote on last edited by
        #3

        thank you victor,
        i kind of solved it myself yesterday with if loops but your answer taught me cleaner ways.

        regards,
        lindeamon

        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