Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

How to query inventory data across all companies efficiently

(0) ShareShare
ReportReport
Posted on by 21
Hello,
 
I am trying to query the Inventory data by writing a select query for /InventWarehouseInventoryStatusOnHandEntity/ with cross-company enabled. 
Due to huge set of data, facing memory issue. Is there any efficient way to query all the inventory details across all companies.
 
 
Thanks!!
  • Martin Dráb Profile Picture
    Martin Dráb 230,468 Most Valuable Professional on at
    How to query inventory data across all companies efficiently
    Moved from Dynamics AX forum.
     
    "It's throwing memory issue" is not the level of details I hoped to get, so I must resort guessing. My assumption is that your problem is not caused by the query, but I guess you're trying to keep all the data in memory. That's the part you need to fix; not the query.
     
    How to fix depends on what you're doing in your code. For example, if you're trying to creating a JSON file, you should write into in in smaller pieces rather then trying to have "entire inventory data" in memory at the same time.
  • PP-08051102-0 Profile Picture
    PP-08051102-0 21 on at
    How to query inventory data across all companies efficiently
    Hi Martin,
     
    It is Finance And Operations version - 10.0.35 Dev VHD setup.
    I have a requirement of fetching entire inventory data across all legal entities/companies.
    So I have created  x++ class to make a select query for entity "InventWarehouseInventoryStatusOnHandEntity" with cross-company enabled as shown below..
     
     InventWarehouseInventoryStatusOnHandEntity inventoryDetails;
     while select crosscompany DataAreaId,ItemNumber,ProductColorId,ProductConfigurationId,ProductSizeId,ProductStyleId ,InventorySiteId, InventoryWarehouseId,InventoryStatusId,AvailableOnHandQuantity,ReservedOnHandQuantity,AvailableOrderedQuantity,ProductName,ReservedOrderedQuantity,OnHandQuantity, AreWarehouseManagementProcessesUsed,OrderedQuantity, OnOrderQuantity,TotalAvailableQuantity from inventoryDetails
    {
       // entity data conversion to json object
    }
     
    But this approach is throwing memory issue.. 
    is there any other way to fetch the bulk data efficiently ??
     
  • Martin Dráb Profile Picture
    Martin Dráb 230,468 Most Valuable Professional on at
    How to query inventory data across all companies efficiently
    First of all, which version of AX is it about?
     
    Then please tell us more about the problem.
     
     

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,759 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,468 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans