Convert String to Numeric

nicolenicole Member Posts: 25
edited 2004-12-01 in Navision Attain
Can anyone please tell me the function to convert a string into numeric?

Thanks in advance!

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    EVALUATE
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Timo_LässerTimo_Lässer Member Posts: 481
    EVALUATE(MyInt,MyString);
    
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • PaLPiTaTioNPaLPiTaTioN Member Posts: 55
    And use this in an IF-construction.

    If you try EVALUATE(intVar,"text") and you don't use the IF-contrsuction, you will get a runtime error because "text" is no integer.
    intVar: integer;
    strVar: text[30];
    
    strVar := '6';
    IF NOT EVALUATE(intVar,strVar) THEN BEGIN
        // this code will not be executed
    END;
    
    strVar := 'test';
    IF NOT EVALUATE(intVar,strVar) THEN BEGIN
        // this code will be executed, because 'test' cannot be converted to integer
    END;
    
Sign In or Register to comment.