Use temp table in reports

1. Create a report
2. Add a data source of your temporary or ‘real’ table to the query
3. Create a simple design
4. Declare your temporary or a ‘real’ table in Class declaration as ‘myTmpTable’
5. Overwrite method ‘run’ on the reportRun and write code like this:
public void run()
   myTmpTable.setTmp(); //only needed if it is a real table and you
                        //want to use as a temporary table in this report,
                        //means if in AOT the table is not declared with
                        //property ‘temporary’.
   myTmpTable.fieldA = ‘A’;
   myTmpTable.insert(); // insert a temporary record into table
   myTmpTable.fieldB = ‘B’;
   myTmpTable.insert(); // insert an other temporary record into table
   element.queryRun().setrecord(myTmpTable); //inform the queryRun to
                                             //use your instance of temporary table
6. If you now execute your report only the two created records should be shown. After loosing the pointer to myTmpTable (when leaving the report) the data inside temporary table doesn’t exist anymore.
This entry was posted in Axapta Development. Bookmark the permalink.

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