Ad Widget

Collapse

absolute value function for calculated item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sir_Yaro
    Member
    • Nov 2008
    • 37

    #1

    absolute value function for calculated item

    Hi.
    Is there aby way to get a absolute value of any the item(s) ?
    I performs subtraction of two values (don't know which is bigger) ​​and as a result I need an absolute value... :/
  • Yello
    Senior Member
    • Apr 2011
    • 309

    #2
    Have you tried delta?


    Regards,
    David

    Comment

    • Sir_Yaro
      Member
      • Nov 2008
      • 37

      #3

      I'm really shocked. 5 minutes ago I was willing to bet 1000$ that I can't use delta for this. But when I checked it on a paper it turned out that I was blind...
      I feel stupid.


      thank you Yello

      Comment

      • arucard
        Junior Member
        • Jul 2012
        • 10

        #4
        Hi,

        i'm wondering if i can use delta also in my case.
        For our business it's very critical to have all server exactly the same time, so i create an item which get ntp offset. Until offset is in <-999ms; 999ms> it's ok, but outside this i should be notified. So i created trigger:
        {My_Template_Servers:ntpq.offset.last(2)}<-999|{My_Template_Servers:ntpq.offset.last(2)}>999

        And of course it works, but i'm curious if i can write this trigger with delta or other way to check absolute value of this item.

        Regards,
        a.

        Comment

        • Sir_Yaro
          Member
          • Nov 2008
          • 37

          #5
          I don't think so. I've two independent values, you have only one. So you can compare only last and previous value (x.last(2)-x.last(1)) and such solutian has a bug:
          (-800)-(-1599)=799
          800-1799=-999

          offset is almost 2sec but delta is still below 1sec...

          ps. please someone else check that

          Comment

          • iprok
            Junior Member
            • Apr 2014
            • 8

            #6
            I feel myself absolutely stupid, but I can't get how to use delta to resolve problem similar to the one Sir_Yaro had. Can anybody make it a little bit clear? I have two values VAL1 and VAL2 and I need a trigger or calculated value counting amount of their difference.

            Comment

            • iprok
              Junior Member
              • Apr 2014
              • 8

              #7
              And my working solution is like:
              (I - J)*(I >= J) + (J - I)*(I < J)

              Comment

              Working...