Together with Microsoft Dynamics AX 2012, there was a new execution mode introduced; called as "IL" execution mode, which is in some references also referred as "CIL" execution mode.
The "IL" stands for ".Net Intermediate Language” and referring to the Intermediate Language available in the .Net Technology, see also X++ Compiled to .NET CIL and X++ Scenarios that are Not Supported in CIL for more information on this topic.
In general, the purpose of this new execution mode is to use as much as possible advantages of the performance improvements that .Net IL-execution can bring to the Microsoft Dynamics AX 2012.
While we can write for several pages about the IL-execution mode, this post will only focus about one practical question, which in some given scenarios can be useful to know, specially when you are busy with the performance optimization of your X++ code.
Here is the question:
“Suppose you use IL-execution mode to populate some data in a tempDB-based temporary table,
How would you access this data back from the X++ context? (i.e. to visualize in a form)”
Well, you might get to know the answer in this post step by step.
First of all, there are a couple of important facts to know:
- The tempDB temporary tables in Microsoft Dynamics AX 2012 are being created under the normal tables node in the tempDB;
- You may retrieve the name of the physical table which keeps the data of your temp table instance in the tempDB, using the following method getPhysicalTableName();
- You may reuse an existing tempDB temporary table instance by calling useExistingTempDBTable(…);
This all together will form the ingredients of our sample code to demo this case.
The following shows how you would link to an existing tempDB temporary table:
And finally the following shows how to pass the reference name of an existing tempDB temporary table to the IL session or i.e. fetch data from an existing tempDB temporary table which is populated in an IL session:
Sample code - Interacting with IL-generated TempDB data
Temporary TempDB Tables: https://msdn.microsoft.com/en-us/library/gg845661.aspx
Microsoft provides programming examples for illustration only,
without warranty either expressed or implied, including, but not limited to,
the implied warranties of merchantability or fitness for a particular purpose.
This post assumes that you are familiar with the programming language that is being demonstrated
and the tools that are used to create and debug procedures.