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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SSRS Report not fetching all records for given date range

(0) ShareShare
ReportReport
Posted on by 2,382

Hello Experts,

I developed custom SSRS report but report not working properly.

Insert method as given below:

private void insertintotmp()
{

    InventDim   inventDim;
    InventTable inventTable;
    InventTransOrigin inventTransOrigin;
    SalesLine       salesLine;
    InventTableModule inventTableModule;
    ;
 
   inventTable =InventTable::find(inventTrans.ItemId);

  select firstOnly inventDim where inventDim.inventDimId == inventTrans.inventDimId;
    select firstOnly inventTransOrigin where inventTransOrigin.ItemId == inventTable.ItemId && inventTransOrigin.RecId == inventTrans.InventTransOrigin;
  
    {
    weekTmp.ItemId = inventTrans.ItemId;
    weekTmp.PQty    =   inventTrans.Qty;
    weekTmp.PAmount =   inventTrans.CostAmountPhysical;
    weekTmp.FAmount =   inventTrans.CostAmountPosted;
    weekTmp.FQty    =   inventTrans.Qty;
    weekTmp.Location = InventDim::find(inventTrans.inventDimId).InventLocationId;
    weekTmp.Site     = inventDim.InventSiteId;

       select firstOnly inventTrans where inventTrans.DateFinancial >= prevMth(today());
              
     {
 
        weekTmp.PQtypre    =   inventTrans.Qty;
    weekTmp.PAmountPre =   inventTrans.CostAmountPhysical;
    weekTmp.FAmountPre =   inventTrans.CostAmountPosted;
    weekTmp.FQtyPre    =   inventTrans.Qty;
 
    }
    weekTmp.PAmountVar = ((weekTmp.PAmount) - (weekTmp.PAmountPre));
    weekTmp.PQtyVar =   (weekTmp.PQty   -   weekTmp.PQtyVar);
    weekTmp.FQtyVar = (weekTmp.FQty  -   weekTmp.FQtyVar);
    weekTmp.FAmountVar  =   (weekTmp.FAmount    -   weekTmp.FAmountPre);
   
    weekTmp.insert();

}
}

Generated report:

7418.21.jpg

While I check in InventTransItem form for same date range there are lot of transaction as given while in my report any showing first record.

211.jpg

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Sheikh Sohail Profile Picture
    6,125 on at

    Have check the firstOnly attribute in your query? kindly remove that and verify again

    select firstOnly inventDim where inventDim.inventDimId == inventTrans.inventDimId;
        select firstOnly inventTransOrigin where inventTransOrigin.ItemId == inventTable.ItemId && inventTransOrigin.RecId == inventTrans.InventTransOrigin;

  • faiz7049 Profile Picture
    2,382 on at

    Sohail, if I removed firstOnly I will not get even any single record and SSRS report/job will be hang.

  • Suggested answer
    Sheikh Sohail Profile Picture
    6,125 on at

    Faiz,

    Job getting hang because there is enough data in invent trans table, Will recommend you to write your complete query in SQL and optimize 1st, implement indexes where required..

    I am not aware about your business requirement, So i will not comment anything on syntax of query  but right now your issue is FirstOnly Keyword...

  • Verified answer
    faiz7049 Profile Picture
    2,382 on at

    Thnaks all, I change some come now it works

    private void insertintotmp()

    {

       InventDim   inventDim;

       InventTable inventTable;

       InventTransOrigin inventTransOrigin;

       SalesLine       salesLine;

       InventTableModule inventTableModule;

       ;

      inventTable =InventTable::find(inventTrans.ItemId);

       {

     select firstOnly inventDim where inventDim.inventDimId == inventTrans.inventDimId;

       select firstOnly inventTransOrigin where inventTransOrigin.ItemId == inventTrans.ItemId && inventTransOrigin.RecId == inventTrans.InventTransOrigin;

       {

       weekTmp.ItemId = inventTransOrigin.ItemId;

       weekTmp.PQty    =   inventTrans.Qty;

       weekTmp.PAmount =   inventTrans.CostAmountPhysical;

       weekTmp.FAmount =   inventTrans.CostAmountPosted;

       weekTmp.FQty    =   inventTrans.Qty;

       weekTmp.Location = InventDim::find(inventTrans.inventDimId).InventLocationId;

       weekTmp.Site     = inventDim.InventSiteId;

       weekTmp.PQtypre    =   inventTrans.Qty;

       weekTmp.PAmountPre =   inventTrans.CostAmountPhysical;

       weekTmp.FAmountPre =   inventTrans.CostAmountPosted;

       weekTmp.FQtyPre    =   inventTrans.Qty;

       weekTmp.PAmountVar = ((weekTmp.PAmount) - (weekTmp.PAmountPre));

       weekTmp.PQtyVar =   (weekTmp.PQty   -   weekTmp.PQtyVar);

       weekTmp.FQtyVar = (weekTmp.FQty  -   weekTmp.FQtyVar);

       weekTmp.FAmountVar  =   (weekTmp.FAmount    -   weekTmp.FAmountPre);

       }

       weekTmp.insert();

    }

    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

#2
Rahul.p Profile Picture

Rahul.p 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans