Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

TempDB table in List page

(0) ShareShare
ReportReport
Posted on by

Hi all,

I want to create a list page with a tempDB table as data source. But I don't know how to insert data to this data source.

insert_recordSet tmpTable (fields) tmpTable select (fields) from table; I put some code in interaction class, so how to get the data source object?

this.listPage().activeRecord(); is incorrect.

Welcome any advices.

Thanks,

Parker

*This post is locked for comments

  • AG-21051816-0 Profile Picture
    on at
    RE: TempDB table in List page

    That only works if the AOT query contains the TempDB Table on the first level. If you add the TempDB Table with an existJoin to a standard table, AX uses a different TempDB Table instance to select the data and the existJoin does not work. This is the same, if you add the TempDB Table dynamically with _query.addDataSource(TableNum(TempDBTable)).

    I did not find any way to archive this with an exists join or inner join. You also have no access to the queryRun object to link the tempDB Table later on. Really sad.

  • Jonathancm Profile Picture
    416 on at
    RE: TempDB table in List page

    yes, in the interaction class...

    Example:

    initializeQuery method:

    tmpTransLocal = this.listPage().activeRecord(queryDataSourceStr(MyQuery, mytempTable)); //This sections throws and error on EP: "Object reference not set to an instance of an object." In desktop client works OK.

    tmpTrans = this.fillTable(tmpTrans,account,fromDate,toDate);

    super(_query);

    tmpTransLocal.linkPhysicalTableInstance(tmpTrans);

  • Jim Bonnie Profile Picture
    60 on at
    RE: TempDB table in List page

    Where does the code go ? In the interaction ListPage class ?

    Does anyone have sample syntax ?

    Thanks, Jim

  • Jonathancm Profile Picture
    416 on at
    RE: TempDB table in List page

    Hi Parker,

    How did you use linkPhysicalTableInstance with this.listPage().activeRecord() ? Or did you used something else. ?

  • Verified answer
    ParkerPeng Profile Picture
    on at
    RE: TempDB table in List page

    Use the linkPhysicalTableInstance method will solve the problem.

  • ParkerPeng Profile Picture
    on at
    RE: TempDB table in List page

    Thank you Rachit Garg, I was try  to create a view, but it seems more slow than generates data to data source.

    My customer need to create a list page to scan data. And they also need to get the newest output order of a salesLine, display the WMSOrderTrans.expeditionStatus to form grid.

    So, I want to create a view or generate data to temp table by:

    select maxof(Recid) from wmsOrder group by wmsOrder.inventTransId. Use the maxOf(Recid) to filter the wmsOrder table.

  • Rachit Profile Picture
    4,015 User Group Leader on at
    RE: TempDB table in List page

    Hi Parker,

    Can you try by creating a view, add it to a query and then use it to populate your list page, instead of using temp tables and see if that solves your problem.

    It would be interesting to know more about the requirement and reason on why you choose to use temp table on a list page?

  • ParkerPeng Profile Picture
    on at
    RE: TempDB table in List page

    I was use the form data source to call the insert_recordSet, so it calls so many RDPs.

    My requierement is change a query that provide data source for a list page:

    SalesLine join WMSOrderTable, we just need the last created output order.

    The SQL like below(cannot achieve)

    while select salesLine

       order by wmsOrder.RecId desc

       join firstonly wmsOrder

           where wmsOrder.InventTransId == SalesLine.InventTransId

    {

       ......

    }

    I cannot call the while... insert, because the data is vast..

  • André Arnaud de Calavon Profile Picture
    294,939 Super User 2025 Season 1 on at
    RE: TempDB table in List page

    Hi Parker,

    What are you trying to achieve? Is the OrderRecId and the RecId the same? The calculation in the query is time consuming. You could create an index on InventTransId, RecId and see if this helps.

    But I wonder... if you share the requierement, probably there might be another possibility...

  • ParkerPeng Profile Picture
    on at
    RE: TempDB table in List page

    Thank you.

    I need to generate these records before the list page was ran. I put some new code as below, but the performance is so bad.

    ListPage/init()

    {

       super();

       insert_recordset tempTable

    (InventTransId, OrderRecId)

    select InventTransId, maxOf(RecId) from wmsOrder

               group by InventTransId;

    }

    Do you have any advices? Very thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
Zain Mehmood Profile Picture

Zain Mehmood 6 Moderator

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans