why error??
*This post is locked for comments
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.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Tocauer 4
AlissonGodoy 2
NNaumenko 2