web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Select and group by subStr()

(0) ShareShare
ReportReport
Posted on by 497

4760.query.png

why error??

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Iulian Cordobin Profile Picture
    8,201 on at
    RE: error query in code x++ class

    Because AX doesn't know how to call that function in a select statement.

    You can however perform the select on the field (remove the subStr from the while select), and then in the while's block get the substring you need in the = line you perform.

  • Martin Dráb Profile Picture
    236,857 Most Valuable Professional on at
    RE: error query in code x++ class

    Because such syntax isn't valid. You can't ask SQL Server to execute X++ methods, and AX doesn't have any feature to directly  translate X++ method calls to SQL functions. Get used to consulting Select statement syntax.

    Regarding the field selection, you could fetch the whole LedgerAccount from database and than extract the substring in X++. Unfortunately you can't group by the function in any way in pure X++, but the solution would be a view with a computed column. You should be able to group by that.

    Nevertheless note that it's a suspicious activity - it seems to suggest that you have multiple pieces of data in a single attribute, which is a violation of normal forms. The query would be much easier and much more efficient if you've designed the schema (or the way how you use the standard schema) correctly.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
AlissonGodoy Profile Picture

AlissonGodoy 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans