Monday, January 9, 2023

How to get data from InventDim for InventSum table


When we get a requirement to fetch the data for InventDim from tables like InventTable , SalesTable , SalesLine , PurchTable , PurchLine its pretty straight forward. All we need to do is check the relations which is based on the field InventDimId

For e.g InventTable.InventDimId = InventDim.InventDimId

But when we have a requirement to get the data from InventSum table which only has transactional records from InventTrans and moreover the data replicates and has no unique index. Its gets difficult most of the time to get the data. 

To save the day InventSum has the method joinChild() 

Given below is a sample code to illustrate the use of joinChild() method : - 

    public display Str1000 getProfVal(InventSum _inventSum)
        InventDim               inventDimJoin;;

        WHSLocationProfile whsLocationProfile = WHSLocationProfile::findByWarehouseAndLocation(inventDimJoin.InventLocationId, inventDimJoin.wMSLocationId);

        return whsLocationProfile.LocProfileId;


That's all for now. Please let us know your questions or feedback in comments section !!!!

How to reverse Free Text Invoice Voucher entries without Dialog

 Hey Folks ,  This blog post is in continuation of the previous post for Reversing Free Text Invoice Voucher entries with Dialog. Only diffe...