Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Numeric Functions In AX 7

Posted on by Microsoft Employee

Hi,

We have developed code to count number of lines for specific values. e.g.  Number of protocols having value 'Protocol1'.

Select count(protocol) from X where X.protocol == 'Protocol1'.

This works in AX 2012 is fine but it is giving error that Protocol should be numeric value in AX 7.

Any function is changes in AX 7 for same? Or is there any other method to count same?

Regards,

Smit

*This post is locked for comments

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Numeric Functions In AX 7

    AX 2012 and prior versions were not so strong typed, so you could play with types and use Implicit conversions. Now it is changed to align with C# and other CIL languages and you need to use explicit conversions like int2str() and so on.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Numeric Functions In AX 7

    Thanks ievgen.

    We thought that alternative way but not sure that it will work. It is working fine. Thanks a lot! But I do not understand same was working for string in Ax 2012.

    Regards,

    Smit

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Numeric Functions In AX 7

    Hi Smit Patel,

    Try

    Select count(RecId) from X where X.protocol == 'Protocol1'.

    Number of records is int value and recId is int as well, so you will get count of records into recId field. In your code you are putting int into string, that's why you get this message.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans