web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to use TempDB as Data Source

(0) ShareShare
ReportReport
Posted on by 28

Dear All,

I hope I am asking the question in the right Forum. 

I have 2 TempDB tables 

CBLTblSchedDataSaleTmp    CBLTblSchedDataSale;
CBLTblSchedDataTemp       _CBLTblSchedDataTemp;

I have inserted some data in _CBLTblSchedDataTemp and I want to use the data, apply some query and write data to another TempDB,  CBLTblSchedDataSale. Extract from my code is as follows

[SrsReportDataSetAttribute(tableStr(CBLTblSchedDataSaleTmp))]
public CBLTblSchedDataSaleTmp Get_CBLTblSchedDataSaleTmp()
{
select CBLTblSchedDataSale;
return CBLTblSchedDataSale;
}

[SrsReportDataSetAttribute(tableStr(CBLTblSchedDataTemp))]
public CBLTblSchedDataTemp Get_CBLTblSchedDataTemp()
{
select _CBLTblSchedDataTemp;
return _CBLTblSchedDataTemp;
}

public void processReport()
{
_Contract=this.parmDataContract() as CBLClsSchedDataContract;
_PRODID=_Contract.prodID();

while
select sum(QtyOrdered), SLD_SALESORDER
from _CBLTblSchedDataTemp
group by SLD_SALESORDER

join _InventDim
where _salesLine.InventDimId==_InventDim.inventDimId

join SizeId, DropId
from _SizeChart
group by SizeId,DropID
where _SizeChart.InventSizeId==_InventDim.InventSizeId

join _ItemData
where _ItemData.ItemId==_salesLine.ItemId
&& _SizeChart.SizeChartId==_ItemData.SizeChartId
{
CBLTblSchedDataSale.SLD_SALESORDER=_CBLTblSchedDataTemp.SLD_SALESORDER;
CBLTblSchedDataSale.QtyOrdered=_CBLTblSchedDataTemp.QtyOrdered;
CBLTblSchedDataSale.SizeID=_CBLTblSchedDataTemp.SizeID;
CBLTblSchedDataSale.DropID=_CBLTblSchedDataTemp.DropID;
CBLTblSchedDataSale.insert();
}

}

The highlighted part is skipped after reading the While Select statement. Help Required

I have the same question (0)
  • Martin Dráb Profile Picture
    238,769 Most Valuable Professional on at

    It's not clear to me what you mean by "The highlighted part is skipped after reading the While Select statement". Please elaborate.

    By the way, your code will be easier to read if you include line indentation. I strongly recommend using Insert > Code (in the rich-formatting view).

    I moved your question from Dynamics AX forum and changed the category to Development / Customization / SDK.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, If I understood correctly, the code in while select condition does not run and gets skipped. If yes, then either one more more conditions in your code is not correct or you don't have related data. It will be easier to create SQL script, check the data and manipulate the sql script to ensure no issues in query.

  • Ferhat.S Profile Picture
    240 on at

    Hey Tayyab,

    As i understand from "The highlighted part is skipped after reading the While Select statement."  you mean your while select statement is empty. I cant see where you filled your _CBLTblSchedDataTemp table. If you are using temp table and filling them another code or scope they are referencing totaly diffrent datas. Make sure you pass filled temp table to data provider class.

    Maybe this one helps your problem : learn.microsoft.com/.../temporary-tempdb-tables

  • André Arnaud de Calavon Profile Picture
    303,354 Super User 2026 Season 1 on at

    Hi Tayyab,

    As mentioned above, there would be no data retrieved based on all the joins and where-clauses. You can use the debugger to check which parameters or variables don't have the correct value to retrieve the data, or like Mohit mentioned try the query in SQL first.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 509 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 375

#3
Adis Profile Picture

Adis 268 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans