Using TempDB Tables in AX 2012 Forms

By Becky Newell | July 1, 2015

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:

public TempDBExampleTable populateTempTable()

{

TempDBExampleTable tempTable;

int I;

for(i = 0;i <= 5; i++)

{

tempTable.Field1 = "string value";

tempTable.Field2 = i;

tempTable.insert();

}

return tempTable;

}

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.)

public class FormRun extends ObjectRun

{

TempDBExampleTable tempTable;

}

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:

public void init()

{

ClassBuildingTempTable classBuildingTempTable = new ClassBuildingTempTable();

super();

tempTable = classBuildingTempTable.populateTempTable();

TempDBExampleTable.linkPhysicalTableInstance(tempTable);

}

 

Related Posts

Recommended Reading:

Manage U.S. Use Tax on Purchase Orders in Dynamics 365 Finance and Operations

  Managing sales tax requirements on your business purchase can be complicated, but Dynamics 365 Finance and Operations can help […]

Read the Article
5.19.22 Dynamics CRM

How to Write a Great Support Ticket in the Stoneridge Support Portal

Submitting a support ticket through the Stoneridge Support Portal is a quick and effective way to get assistance for any […]

Read the Article

Managing Your Business Through Uncertain Times Using Dynamics 365 Finance and Operations

  Dynamics 365 Finance and Operations (F&O) can help you make informed decisions on how to move your business forward. […]

Read the Article
5.13.22 Power Platform

Using Power BI Object Level Security

  The following article will demonstrate how to use Power BI Object Level Security to disable column data based on […]

Read the Article
5.12.22 Dynamics CRM

How to Use the Stoneridge Support Portal

Stoneridge Software’s support portal is an intuitive and useful function that makes it easy for you to access resources to […]

Read the Article
5.6.22 Dynamics GP

Dynamics GP Transaction Removal: Purchase Orders

  Are you having performance issues with Purchase Orders?  Do you find that there are old Purchase Orders on your […]

Read the Article
5.5.22 Dynamics GP

The Real Story about the Long-Term Future of Dynamics GP Support

I’ve seen a number of people put forward comment that Dynamics GP is going away and you have to get […]

Read the Article

New Features in Dynamics 365 Business Central 2022 Wave 1 Release – Financial Enhancements

The Dynamics 365 Businses Central 2022 Wave 1 Release has a lot of new and exciting features to help your […]

Read the Article
4.29.22 Dynamics GP

Dynamics GP Transaction Removals: Bank Reconciliation

  This is part 2 of a 3 part series on Dynamics GP Transaction Removals. These quick tips will hopefully […]

Read the Article

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X