Using TempDB Tables in AX 2012 Forms

by | Updated August 15, 2016 | Development, Dynamics AX

Having temporary tables stored in the tempDB database is a feature new to AX 2012.  It isn’t difficult to use temporary tables to populate forms but the steps deviate from using InMemory temporary tables with forms.  Given that difference, I thought I would document here how to use tempDB tables as datasources in AX 2012 forms.

1. Create a temporary table with the fields required.  In the property sheet for the table set the TableType property to TempDB.

2. Create a class to populate the temporary table.  For example, in step #1 create a table named TempDBEXampleTable.  Then create a class with a method that populates and returns a populated TempDBExampleTable:

3. Create a form and add the TempDBExampleTable as the datasource to the form.

4. In the classDeclaration of the form declare an instance of the TempDBExampleTable table.  (This step isn’t required but this is how I chose to build my form.)

5. In the init method of the form datasource instantiate the class you created in step #2.

6. Still in the datasource’s init method, call the method created in step #2 to populate the temporary table and set the class variable equal to what the method returns.

7. Still in the datasource’s init method, from the buffer for the datasource call the linkPhysicalTableInstance method and pass it the populated temporary table returned in step #6.  The code for the datasource’s init method should look something like this:


Related Posts

  • This is just a nagging little thing I ran into recently with AX 2012 Forms. Maybe I can save some of you the time and aggravation. I was designing a…

  • In addition to RAM and CPU needs, Windows applications typically consume two types of limited system resources, USER and GDI objects. Windows limits the number of each object type that…

  • The Safari browser is now supported natively on Dynamics AX 2012 R2 as well as being supported on Dynamics AX RTM with a hotfix.  Taken from the updated System Requirements…


  1. LennyK

    Hi Becky, I tried this approach, but on the line:

    I get a compiler error saying that “Variable TempDBExampleTable has not been declared”

  2. LennyK

    Sorry, on the above example, I realized that TempDBExampleTable is actually the name of the DataSource on the Form and not your temporary table type. That worked, thanks!

  3. Brandon Carmichael

    Hello LennyK,

    Thank you for your comments – glad it worked for you as expected.


  4. Srikanth

    Hi Becky,
    Thanks for the detailed steps. It really helped me a lot.

  5. Srikanth

    This is good if the form opens without any parameters. But, how does it work when you have to populate the temp table based on the parameters on the form like for example on the button click.

  6. Michael Tweiten

    Hi Srikanth,

    We would recommend creating a separate dialog form that grabs parameters from the user, sets parameter methods on a class, populates a temp table, and opens a second form. The second form would then use the temp table.
    Let me know if you have anymore questions.


Submit a Comment

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

Upcoming Events


02jun2:00 pm2:30 pmBusiness Intelligence for Batch Manufacturers

16jun10:00 am10:30 amHow AP automation can speed up month-end close in D365 Finance

17jun11:00 am12:00 pmConfab Live with Stoneridge – Real Time Marketing Strategies for Success

23jun10:00 am10:30 amThe Modern Manufacturer: Cost Accounting in D365

30jun10:00 am10:30 amAP Automation Checklist for a 2022 Rebound

30jun2:00 pm2:30 pmAchieving Success: How Technology Is Helping Nonprofits Thrive


01jul11:00 am12:00 pmConfab Live with Stoneridge – Dataverse Virtual Entities

14jul12:00 pm12:30 pmBeyond Reporting - What Business Intelligence Can Do For Your Agribusiness

15jul11:00 am12:00 pmConfab Live with Stoneridge – Integration Strategies for End User Success

21jul10:00 am10:30 amThe Modern Manufacturer: Manufacturing Software in the Real World

21jul12:00 pm1:00 pmIs it Worth it to Upgrade to Dynamics 365 Finance and Supply Chain Management? - Everything AX Users Need to Consider

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!