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

september

01sep10:00 am10:30 amEnsuring Quality and Compliance for Batch Manufacturers in Life Sciences

01sep12:00 pm12:30 pmIs it Worth It to Move to the Cloud? A Look at Considerations for Current Agribusinesses Using Dynamics GP

01sep2:00 pm2:45 pmWhat’s New in Dynamics 365 Finance and Supply Chain

09sep11:00 am12:00 pmConfab Live with Stoneridge – Data Strategy and Reporting – Mining Decision Making Insights

15sep10:00 am11:00 amSolving the Biggest Challenges in Agribusiness Through Innovation and Technology

22sep12:00 am12:30 pmSimplifying Payroll and HR Management with ADP Workforce Now

22sep10:00 am10:30 amStreamlining Batch Manufacturing with Technology

22sep2:00 pm2:30 pmProcess Automation for Microsoft Dynamics D365 for Business Central, Finance and Operations and GP

23sep11:00 am12:00 pmConfab LIVE with Stoneridge - Riding the Wave 2 Release – Key Features Coming to Dynamics 365 this October

29sep10:00 am11:00 amTop Five Reasons Why NOW is the Right Time to Move from Salesforce to Dynamics 365 Customer Engagement

29sep12:00 pm12:45 pmUnderstanding Job Costing and Tax Management in Business Central

29sep2:00 pm3:00 pmDigitalizing Horticulture & Agriculture - How to Sell Plants Online and Simplify Business Management

30sep12:00 pm4:00 pmSecurity and Permissions Training for D365 Business Central or Dynamics NAV

october

06oct10:00 am10:30 amPreview of D365 Business Central Fall Release Features and Functionality

06oct12:00 pm12:30 pmInsider's Guide to New Features Available in the Fall Release of D365 Finance and Supply Chain

07oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Technical

21oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Functional

26oct(oct 26)9:00 am28(oct 28)5:00 pmStoneridge Connect Leadership and Community Conference

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