Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

How to convert str2int64 in ax 2012.

(0) ShareShare
ReportReport
Posted on by 630

Hi friends,

I am using below code for changing string value to Int64.

    str          curCompany;    
    Int64 	 myInt64;

    curCompany  = curext();

    myInt64 = str2int64(curCompany);

    info(strFmt('%1',myInt64));

But in info i am not getting any value.

Please let me know how to convert str2int64 in ax 2012.

Thanks & Regards

Rahul.

  • Suggested answer
    ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: How to convert str2int64 in ax 2012.

    str         curCompany;    
    Int64 	    myInt64;
    
    curCompany  = "123";//curext();
    myInt64 = str2int64(curCompany);
    info(strFmt('%1',myInt64));// 123 //real purpose of str2int methods
    
    curCompany  = "ABC";//curext();
    myInt64 = str2int64(curCompany);
    info(strFmt('%1',myInt64));// 0

  • Suggested answer
    greengrimms Profile Picture
    greengrimms 1,400 on at
    RE: How to convert str2int64 in ax 2012.

    Hi Rahul,

    What value are you getting from curext() function? Maybe it contains a character that might not be able to convert to integer. I tried converting a string to int64 and printing it and I'm seeing a value, since strFmt converts your value back to string:

    pastedimage1625584677461v2.png

    Now, if I run it in my current company (DAT), I get a 0, which is expected:

    pastedimage1625584550082v1.png

    Also, if I may advice, it's not a good practice to run this types of conversions if you're not 100% sure on the input you're going to get.

    Hope it helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans