How to use Temp table as data source of form in AX 2012

Yes, you can use temporary table as datasource whether it is of type tempDb or InMemory.

I assumed that you have temporary table ready and just need to drag in to the form datasource.

Now, Create one method named insertRecords at form level.


TmpTable insertRecords()

TmpTable tmpTableBuffer;
OtherTable otherTableBuffer;

while tmpTableBuffer
tmpTableBuffer.field1 = otherTableBuffer.field1;
tmpTableBuffer.fieldn = otherTableBuffer.fieldn;

Now, call this method in init method of form after super.

public void init()


// important thing comes here
// if table is of type InMemory,call following method.


// if table is of type tempDb, call following method.


Please let me know if you have any queries.

Happy Daxing…….


3 responses

  1. approach but I get a compiler error saying “Variable TmpTable has not been declared”


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

    Liked by 1 person

    1. You are welcome.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: