Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Numeric Functions In AX 7

(0) ShareShare
ReportReport
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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans