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

To remove the packing slip which have the returned lines

(0) ShareShare
ReportReport
Posted on by 1,836
hi 
i am working on report which brings all the packing slips but i want to remove the packing which have the return lines i.e where the quantity or amount is zero , as therecan be multiple lines for one packing slip so how can i get this done without getting the report execution slow and with proper output , what join i have to use in below query so i can get the desired output . my code is below in comments.
 
thanks ,
regards ,
Dinesh
  • Dineshkarlekar Profile Picture
    1,836 on at
    hi ,
    here is my code 
       else if(LocationId != "" && salesPoolIdFilter == "")
            {
                insert_recordset dtPODReportTmp(SalesId,OrderAccount,PackingSlipId,DTDeliveryRequestId,PackingSlipDate,PackingSlipRecId,Company,inventLocationId,ShipCarrierWaybill,PlateNum, DlvMode,ShipCarrierPhone,WorkerSalesTaker)
                        select SalesId,OrderAccount,PackingSlipId,DeliveryRequestId,DeliveryDate,RecId,DataAreaId,inventLocationId,ShipCarrierWaybill,PlateNum, DlvMode,ShipCarrierPhone from  custPackingSlipJour
                    join WorkerSalesResponsible from salesTable
                        where salesTable.SalesId == custPackingSlipJour.SalesId
                        &&    custPackingSlipJour.inventLocationId == LocationId
                        &&  custPackingSlipJour.DeliveryDate >= fromDateFilter
                        &&  custPackingSlipJour.DeliveryDate <= toDateFilter;
            }
    thnaks ,
    Dinesh
  • Martin Dráb Profile Picture
    241,643 Most Valuable Professional on at
    Your code still ignores the fact that a single packing slip can contain several orders. You should use CustPackingSlipSalesLink for the relation between sales orders and packing slips. I recommend you fix this bug before building more features on top of your solution.
  • Dineshkarlekar Profile Picture
    1,836 on at
    hi ,
    martin 
    thanks for reply ,
     is it possible to use CUSTPACKINGSLIPTRANS i am also getting quantity  and amount here , i have made the select query plz have look on it plz let me know if i can use it .
    select custPackingSlipJour.SalesId,custPackingSlipJour.PACKINGSLIPID
            from  custPackingSlipJour
    join  salesTable
          on  salesTable.SalesId = custPackingSlipJour.SalesId
    join CUSTPACKINGSLIPTRANS  
         on CUSTPACKINGSLIPTRANS.PACKINGSLIPID =  custPackingSlipJour.PACKINGSLIPID
         and  custPackingSlipJour.inventLocationId = 'W03'
         --and  custPackingSlipJour.DeliveryDate >= '2023-1-1'
         --and  custPackingSlipJour.DeliveryDate <= '2023-8-31'
    	 where CUSTPACKINGSLIPTRANS.QTY >= 0
    	  and  CUSTPACKINGSLIPTRANS.VALUEMST >= 0 
    	 group by 
    	 custPackingSlipJour.PACKINGSLIPID,custPackingSlipJour.SalesId
     
  • Martin Dráb Profile Picture
    241,643 Most Valuable Professional on at
    As I said, I would start by fixing the known bug. You want to relate multiple packings slips for an order but your code may fail to find some or all of them. Even if you designed a flawless solution, it would fail when with such incomplete inputs.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 265 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 215

#3
Subra Profile Picture

Subra 177 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans