how we can check a number is integer or decimal in nav

Inside the validation of quantity I need to validate whther it is a decimal or integer how can we write code in nav

Answers

  • David_Singleton
    David_Singleton Member Posts: 5,479
    edited 2017-08-02
    IF (Quantity MOD 1) = 0 then
    message('Var A is an Integer');
    David Singleton
  • JohnHunter
    JohnHunter Member Posts: 45
    IF Quantity = ROUND(Quantity,1) THEN
    MESSAGE('Var A is an integer');
  • nick_robbo
    nick_robbo Member Posts: 49
    Could you make use of the a Variant variable?

    So passing it to a function as a Variant and using Variant.ISDECIMAL/ Variant.ISINTEGER

  • Renu1989
    Renu1989 Member Posts: 11
    I need the code for decimal checking no need to display for integer
    so please give me a code which check whther input is decimal
  • Slawek_Guzek
    Slawek_Guzek Member Posts: 1,690
    edited 2017-08-22
    IsInteger = EVALUATE(DecimalVar, InputText) AND (DecimalVar = ROUND(DecimalVar, 1))
    IsDecimal = EVALUATE(DecimalVar, InputText) AND (DecimalVar <> ROUND(DecimalVar, 1))
    
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03