How to Search X++ Code Using Dynamics AX Model Database

by | Updated December 18, 2017 | Dynamics 365 for Finance and Operations, Dynamics AX

If you started your development career in Visual Studio and then had to switch to MorphX IDE, one of the features you probably miss is ‘Find in Entire Solution’.

In Visual Studio, the ‘Find’ functionality is very robust – allowing us to search and/or replace in the entire Visual Studio Solution via keywords, matching case, matching whole word and even allowing us to use regular expressions.

'Find' functionality in Video Studio.

In MorphX IDE, the ‘Find’ functionality is ‘decent’ and works best if you are searching within an object, like a Class or Table, but if you want to find something across all objects – meaning the entire AOT, it’s probably going to take a long time to search. I lost my patience after waiting for couple hours for the search below to finish…

'Find' functionality in MorphX IDE.

‘What If’ you could query the Dynamics AX Model Database to find a string across all objects? Well, using the simple SQL Query below, you can. Here’s how to search X++ code using Dynamics AX model database:

 

The query results took ~26 seconds to find the 7 objects where ‘FDD-003’ is mentioned.

Using a simple SQL query to search for specific X++ code.

The ‘Where’ clause in the query above can be modified to better fit the text comparison you are looking for, using one of the following SQL operators: =, <>, >, >=, <, <=, IN, BETWEEN, LIKE, IS NULL or IS NOT NULL.

If your requirement is to not look for a string in a method, but instead where the object has been used – ‘Cross Reference’ system in Dynamics AX allows you to see the relationships between objects. For example, you can get a list of every piece of code that uses a particular method, or you can see which forms use a particular table field. You can also get information about where labels are used in the application, but we can’t use the cross reference to look for a string inside a method.

Happy coding!

Related Posts

  • Over on the AX Support site on MSDN, Daniel Durrer has taken the time to keep tabs on the latest builds for Microsoft Dynamics AX 4.0, 2009 and 2012.  I…

  • I have been asked a few times if Dynamics AX can connect to non-AX databases and the answer is yes.  You do this is by creating an ODBC data source…

  • If you want to take advantage of the new capabilities in Microsoft SQL Server 2012, you're going to have to do some extra work to get Microsoft Dynamics AX 2012…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

august

13aug11:00 am12:00 pmConfab with Stoneridge - Livestream - Inspire Keynote Breakdown

19aug10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

19aug12:00 pm12:30 pmThe Modern Manufacturer - Death by Safety Stock

27aug12:00 pm1:00 pmConfab with Stoneridge - Livestream - Dynamics 365 2020 Wave 2 Preview

september

02sep10:00 am10:30 amThe Modern Manufacturer - Cycle Count Management

09sep10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

16sep10:00 am10:30 amThe Modern Manufacturer - Product Lifecycle Management

30sep10:00 am10:30 amThe Modern Manufacturer - Return Management

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X