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…

6 Comments

  1. LennyK

    Hi Becky, I tried this approach, but on the line:
    TempDBExampleTable.linkPhysicalTableInstance(tempTable);

    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.

    Thanks,
    Brandon

  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.

    Regards,
    Michael

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