Math with VAR



  • Hi
    How can I do following
    Math (plus, minus, multiplying, dividing) variables

    Ex.

    IF <VAR1> - <VAR2>  GreaterThan 7862400
    ELSE
    ENDIF
    

  • Admin

    Use the Compute function block in order to make a VAR3 and then use that like IF "<VAR3>" GreaterThan "..."



  • OK, did the computing, BUT the IF statement goes into a loop, and I have manuel to shutdown the program

    <--- Executing Block UnitUNIXdate2 --->
    Executed function DateToUnixTime on input 31/12-19 with outcome 1577750400
    Parsed variable | Name: UNIXdate2 | Value: 1577750400
    
    <--- Executing Block FUNCTION_CHECKb --->
    Executed function Compute on input 1585814659 - 1577750400 with outcome 8064259
    Parsed variable | Name: CHECKb | Value: 8064259
    
    
    IF  <CHECKb> GreaterThan "7862400"
    PRINT "Deleting Unit 1"
    ENDIF
    


  • Problem is the variable is treated as a text and not a number.
    How can I change this?

    it works if I write

    IF "8063950" GreaterThan "7862400"
    

  • Donator

    i saw a mistake in your code you didnt put your variable in quotes

    IF  "<CHECKb>" GreaterThan "7862400"
    PRINT "Deleting Unit 1"
    ENDIF
    

    works fine for me

    9ac6b2b4-b2bb-4c7a-a4f7-a760f04e8f5b-image.png



  • Thanks, now it works 🙂


Log in to reply