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. Possilbe bug: Float DCI values below 1 display unnecessary trailing zeroes with

Possilbe bug: Float DCI values below 1 display unnecessary trailing zeroes with

Scheduled Pinned Locked Moved Support
2 Posts 2 Posters 31.2k 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.
  • E
    E
    Egert143
    wrote on last edited by
    #1

    Float DCI values between approximately 0.01 and 1 are displayed with unnecessary trailing zeroes when using a measurement unit with default multipliers.

    For example, I am monitoring current from a PDU over SNMP.

    The SNMP device returns integer values that are divided by 100 using a transformation script:

    return $1 / 100;

    For a phase current:

    Raw value: 303
    Transformed value: 3.03
    Displayed value: 3.03 A

    This is displayed correctly.

    However, for the neutral current:

    Raw value: 68
    Transformed value: 0.68
    Displayed value: 0.680000 A

    The expected display value would be:

    0.68 A
    Configuration
    NetXMS server/client version: 6.1.1
    DCI type: SNMP
    Data type: Float
    Unit: A
    Multipliers: Default
    Transformation:
    return $1 / 100;
    Steps to reproduce
    Create an SNMP DCI returning an integer value such as 68.
    Set the DCI data type to Float.
    Set the measurement unit to A.
    Leave multipliers at the default setting.
    Add the transformation:
    return $1 / 100;
    The transformation test correctly shows 0.68.
    After normal data collection, Last Values displays:
    0.680000 A

    Using the same configuration with a raw value such as 303 produces:

    3.03 A

    as expected.

    I also duplicated a working DCI that displayed 3.03 A correctly and changed only the SNMP OID so that the returned/transformed value was below 1. The duplicated DCI immediately showed the same 0.680000 A behavior, so the issue does not appear to be caused by a DCI configuration difference.

    Expected behavior

    Float values should use consistent formatting regardless of whether the value is above or below 1.

    For example:

    3.030000 -> 3.03 A
    0.680000 -> 0.68 A
    Actual behavior

    Values greater than or equal to 1 are formatted without unnecessary trailing zeroes:

    3.030000 -> 3.03 A

    while values below 1 may retain the complete float string:

    0.680000 -> 0.680000 A
    Additional information

    The behavior appears to still be present in the DataFormatter implementation in NetXMS 6.2.3 and current master.

    It appears that when the default multiplier logic cannot select a multiplier for a value below 1, the original value string is retained instead of being converted to a Double. The %s formatting path then only applies the normal decimal formatting when the value is a Double, causing the original 0.680000 string to be displayed unchanged.

    The underlying numeric DCI value appears to be correct; this seems to be a display/formatting issue.

    1 Reply Last reply
    0
    • A
      A
      Alex Kirhenshtein
      wrote on last edited by
      #2

      Hi,

      Confirmed, and thanks for tracing it - your reading is exactly right. When no multiplier applies the value stays a String, so the %s path skips the decimal trimming. Tracked as https://github.com/netxms/netxms/issues/3577.

      Until that's fixed, setting an explicit display format on the DCI works around it: %{m,u}.2f instead of leaving it empty. The f conversion parses the string into a number first, so the trimming happens. Cost is that it's per-DCI and pins you to two decimals regardless of magnitude.

      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