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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

x++ code to get the value of the method "Reservation" in batch reservation form

(4) ShareShare
ReportReport
Posted on by 275
Hello
 
i have a custom report im developing, i need to retrieve the value of field Reservation in batch reservation form, to go through this form, first go All sales order and check sales line, make sure u are selecting a line order(itemid). then click on inventory and click after on batch reservation.
i need the x++ code to be able to retrieve the value knowing that its a method and not a field on the form. the method name is reserveNowQty() in form data source of table TmpPdsBatchSelect in form WHSBatchAttribReserve.
if anyone can provide me the code that i need to implement in my DP class please. it should be based on Itemid because each salesline has a a different ItemID.
 
Thank you
 
here is my dp class
   public void processReport()
   {
       InventQualityOrderTable InventQualityOrderTable;
       InventQualityOrderLine InventQualityOrderLine;
       InventTransOrigin InventTransOrigin;
       InventDim InventDim;
       SalesLine salesLine;
       TmpPdsBatchSelect tmpBatchSelect;
       PdsQtyReservation reservationQty;
       inventTrans inventTrans;
       WHSInventReserve WHSInventReserve;
       contract = this.parmDataContract() as IS_SalesBOTContract;
       itemid = contract.parmItemId();
       salesid = contract.parmSalesId();
      
       select salesLine
   where salesLine.SalesId == salesid && salesLine.ItemId == itemid;

       select firstOnly * from inventTransOrigin
   where inventTransOrigin.InventTransId == salesLine.InventTransId;

       select firstOnly * from inventTrans
   where inventTrans.InventTransOrigin == inventTransOrigin.RecId;

       while select inventDim
   join whsInventReserve
   where inventDim.InventDimId == whsInventReserve.InventDimId
   && inventDim.InventBatchId != ''           
   && whsInventReserve.ItemId == salesLine.ItemId 
       {
           
           select firstOnly * from inventQualityOrderTable
       where inventQualityOrderTable.ItemId == salesLine.ItemId
       && inventQualityOrderTable.InventDimId == inventDim.InventDimId;

           while select InventQualityOrderLine where InventQualityOrderLine.QualityOrderId == InventQualityOrderTable.QualityOrderId
           {
           header.clear();
           header.ItemId = salesLine.ItemId;
           header.SalesId = salesLine.SalesId;
           header.QualityOrderId = InventQualityOrderTable.QualityOrderId;
           header.TestGroupId = InventQualityOrderTable.TestGroupId;
           header.Qty = InventQualityOrderTable.Qty;
WHAT I NEED IS TO PRINT THE VALUES THAT HAVE "RESERVATION" > 0.
Categories:
I have the same question (0)
  • Suggested answer
    Holly Huffman Profile Picture
    6,538 Super User 2025 Season 2 on at

    Hi there!

    • In the code below, added the logic to retrieve the value of the reserveNowQty() method from the TmpPdsBatchSelect table and check if it is greater than 0.
    • If it is, the value is stored in the header.ReservationQty field, and you can add your code to print or store the header information accordingly.

    hope this helps! 

     

     

     
    public void processReport()
    {
        InventQualityOrderTable inventQualityOrderTable;
        InventQualityOrderLine inventQualityOrderLine;
        InventTransOrigin inventTransOrigin;
        InventDim inventDim;
        SalesLine salesLine;
        TmpPdsBatchSelect tmpBatchSelect;
        PdsQtyReservation reservationQty;
        inventTrans inventTrans;
        WHSInventReserve whsInventReserve;
        contract = this.parmDataContract() as IS_SalesBOTContract;
        itemid = contract.parmItemId();
        salesid = contract.parmSalesId();
       
        select salesLine
        where salesLine.SalesId == salesid && salesLine.ItemId == itemid;
        select firstOnly * from inventTransOrigin
        where inventTransOrigin.InventTransId == salesLine.InventTransId;
        select firstOnly * from inventTrans
        where inventTrans.InventTransOrigin == inventTransOrigin.RecId;
        while select inventDim
        join whsInventReserve
        where inventDim.InventDimId == whsInventReserve.InventDimId
        && inventDim.InventBatchId != ''           
        && whsInventReserve.ItemId == salesLine.ItemId 
        {
            select firstOnly * from inventQualityOrderTable
            where inventQualityOrderTable.ItemId == salesLine.ItemId
            && inventQualityOrderTable.InventDimId == inventDim.InventDimId;
            while select InventQualityOrderLine where InventQualityOrderLine.QualityOrderId == inventQualityOrderTable.QualityOrderId
            {
                // Retrieve the value of reserveNowQty() method
                tmpBatchSelect = TmpPdsBatchSelect::find(InventQualityOrderLine.InventBatchId);
                reservationQty = tmpBatchSelect.reserveNowQty();
                
                if (reservationQty > 0)
                {
                    header.clear();
                    header.ItemId = salesLine.ItemId;
                    header.SalesId = salesLine.SalesId;
                    header.QualityOrderId = InventQualityOrderTable.QualityOrderId;
                    header.TestGroupId = InventQualityOrderTable.TestGroupId;
                    header.Qty = InventQualityOrderTable.Qty;
                    header.ReservationQty = reservationQty;
                    // Add your code to print or store the header information
                    // For example: print or store header
                }
            }
        }
    }
     
     
  • ISDev Profile Picture
    275 on at
    hello Holly,
     
    i tried ur code but got those errors
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    This is a duplicate of Whats the x++ code to get the value of the method "Reservation" in batch reservation form. Please select a thread - continue the discussion in one and abandon the other.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans