SSRS Pack Slip Qty Multiplying by 4

Hidey Ho! Epicor SSRS report issues again :sob: By the end of this I should be a semi expert on what not to do or have no hair left.

I modified the pack slip report by adding some UD fields that are contained in the OrderHed table.
That part works great. The issue I’m having is that the quantity looks like it is multiplying by 4. Did Epicor pick some rando number to multiple the quantity by?

correct quantities

when i add the ud fields and join on orderhed

="SELECT CASE WHEN ISNULL(T4.Countrow, 0) = 0 THEN CONVERT(BIT, 0) ELSE CONVERT(BIT, 1) END ExistMisc,
T3.PONum,
T3.PhoneNum RptLabels_PhoneNum,
T3.FaxNum RptLabels_FaxNum,
T3.RevisionNum RptLabel_RevisionNum,
T1.Customer_EMailAddress,
T1.Customer_FaxNum,
T1.Company,
T1.LegalNumber,
T1.PackNum,CAST( T1.CustNum as nvarchar ) as CustNum,
T1.ShipComment,
T1.ShipDate,
T1.Calc_BilContct,
T1.Calc_BillToAddress,
T1.Calc_SoldToAddress,
T1.Calc_Contct,
T1.Calc_CustPartOpts,
T1.Calc_FOBDescription,
T1.Calc_LegalNum,
T1.Calc_NumRecordPerPage,
T1.Calc_NumTotalParts,
T1.Calc_SalesRepName,
T1.Calc_ShipToAddress,
T1.Calc_ShipViaDescription,
T1.Calc_stPhone,
T1.Calc_CusPhone,
T1.Calc_stFax,
T1.Calc_EMailAddress,
T1.Calc_FaxNum,
T1.Calc_SEmailAddr,
T1.Calc_CarrierDesc,
T1.Calc_ShipViaSCAC,
T1.Calc_CarrierSCAC,
T2.PackLine,
T2.Discount,
T2.ExtPrice,
T2.HeaderShipComment,
T2.LineDesc,
T2.OrderLine,
T2.OrderNum,
T2.OrderRelNum,
T2.PartNum,
T2.RevisionNum,
T2.ShipComment as ShipDtl_ShipComment,
T2.UnitPrice,
T2.XPartNum,
T2.XRevisionNum,
T2.Calc_DspBackOrdQty,
T2.Calc_DspBackOrdQtyUom,
T2.Calc_DspLabDur,
T2.Calc_DspLabMod,
T2.Calc_DspLineDesc,
T2.Calc_DspLineShpQty,
T2.Calc_DspLineShpQtyUom,
T2.Calc_DspMatDur,
T2.Calc_DspMatMod,
T2.Calc_DspMiscDur,
T2.Calc_DspMiscMod,
T2.Calc_DspPlannedQty,
T2.Calc_DspPlannedQtyUom,
T2.Calc_DspSerialNumber,
T2.Calc_DspShipRouting,
T2.Calc_DspSubShipTo,
T2.Calc_GetNextLegalNum,
T2.Calc_LegalText,
T2.Calc_LinChangd,
T2.Calc_NextLegalNumID,
T2.Calc_NumLineByInv,
T2.Calc_OrdRelRef,
T2.Calc_POLine,
T2.Calc_SalesRepName as ShipDtl_Calc_SalesRepName,
T2.Calc_SerialNumLabl,
T2.Calc_TotalLineCost,
T2.Calc_TotalTax,
T2.Calc_HidePackLine,
T2.OrderLine_KitFlag,
T2.OrderLine_KitParentLine,
T2.OrderLine_KitPrintCompsPS,
T2.OrderLine_DisplaySeq,
T2.OrderLine_KitShipComplete,
T2.Calc_MarkForAddress,
T2.OrderNum_PONum,
T2.PartNum_PartDescription,
T2.PCID,
T2.Calc_CommodityCode,
T3.RptLiteralsLblDescription,
T3.RptLiteralsLblFax,
T3.RptLiteralsLblEmail,
T3.RptLiteralsLblRel,
T3.RptLiteralsLblPh,
T3.RptLiteralsLblPO,
T3.RptLiteralsLblRev,
T3.RptLiteralsHComponents,
T3.RptLiteralsLblBckOrQty,
T3.RptLiteralsLblCustPart,
T3.RptLiteralsLblDiscAmt,
T3.RptLiteralsLblExtendedPrice,
T3.RptLiteralsLblFOB,
T3.RptLiteralsLblHdngPckSlip,
T3.RptLiteralsLblLbDu,
T3.RptLiteralsLblLine,
T3.RptLiteralsLblMiDu,
T3.RptLiteralsLblMtDu,
T3.RptLiteralsLblOurPrt,
T3.RptLiteralsLblPackSlip,
T3.RptLiteralsLblPage,
T3.RptLiteralsLblPlndQty,
T3.RptLiteralsLblPoLine,
T3.RptLiteralsLblPrtNum,
T3.RptLiteralsLblReference,
T3.RptLiteralsLblSalesOrder,
T3.RptLiteralsLblSalesperson,
T3.RptLiteralsLblShipDt,
T3.RptLiteralsLblShipRouting,
T3.RptLiteralsLblShipTo,
T3.RptLiteralsLblShipVia,
T3.RptLiteralsLblShpdQty,
T3.RptLiteralsLblSoldTo,
T3.RptLiteralsLblSrlNum,
T3.RptLiteralsLblSrlNums,
T3.RptLiteralsLblSubShipTo,
T3.RptLiteralsLblTotalLineCost,
T3.RptLiteralsLblTotalTax,
T3.RptLiteralsLblUnitPrice,
T3.RptLiteralsLblYourPO,
T3.RptLiteralsLLegalText,
T3.RptLiteralsLLegNum,
T3.RptLiteralsLSalesKit,
T3.RptLiteralsLCarrierSCAC,
T3.RptLiteralsLCarrier,
T3.RptLiteralsLblShipViaSCAC,
T3.RptLiteralslblInvNumber,
T3.RptLiteralslblInvDueDate,
T3.RptLiteralsLblOf,
T3.RptLiteralsLblContinueOnNext,
T3.RptLiteralsLblComeFrom,
T3.RptLiteralsLblPCID,
T3.RptLiteralsLCommodityCode,

/addtional fields
T5.AddtlShipContactName_c,
T5.AddtlShipPhoneNum_c,
T5.AddtlShipEmail_c,
T5.AddtlShipAddInfo1_c,
T5.AddtlShipAddInfo2_c


FROM ShipHead\_" + Parameters!TableGuid.Value + " T1
LEFT OUTER JOIN ShipDtl\_" + Parameters!TableGuid.Value + " T2 ON T1.Company = T2.Company AND T1.PackNum = T2.PackNum
LEFT OUTER JOIN RptLabels\_" + Parameters!TableGuid.Value + " T3 ON T1.RptLanguageID = T3.RptLanguageID
LEFT JOIN (SELECT Company, PackNum, COUNT(PackNum) Countrow FROM ShipMisc\_" + Parameters!TableGuid.Value + " GROUP BY Company, PackNum) T4 ON T1.Company = T4.Company AND T1.PackNum = T4.PackNum

/added orderhed join
LEFT JOIN OrderHed\_" + Parameters!TableGuid.Value + " T5 ON T1.Company = T5.Company AND T2.OrderNum = T5.OrderNum"

More than happy to help you with this, can you please provide the join in the RDD that you made?

I’m looking for the report data definition join that you made, so an epicor screenshot.

INNER JOIN OrderHed\_" + Parameters!TableGuid.Value + " T5 ON T1.Company = T5.Company AND T2.OrderNum = T5.OrderNum"

Your join has T2 - I think that’s ShipDtl and not OrderHed.

Try the below change…

INNER JOIN OrderHed\_" + Parameters!TableGuid.Value + " T5 ON T1.Company = T5.Company AND T1.OrderNum = T5.OrderNum"

Tammy, I don’t need the RDL or the sql statement from the RDL, I guess my question is, did you use the base report data definition that came with Epicor or did you make your own?

Yes, I used the base RDL and added my ud fields and the join to orderhed.

Good catch. I had to use T2 though as ordernum is not on the shiphead table where ShipDtl does have it.

But it’s still showing the quantities incorrectly. :roll_eyes:

Argh…OK, back to the drawing board.

EDIT - actually that may explain the multiplying…if you joined to ShipDtl, how many records tie to that ShipHead?

What is the expression in your sum field?

Tammy, are you on prem?

Either way, can you make another dataset in your report and write this query in it:

=“SELECT T1.OrderNum FROM OrderHed\_” + Parameters!TableGuid.Value + " T1 "

And then add a query field to that dataset and put OrderNum and OrderNum in the fields.

Then can you add a tablix with that new dataset as it’s data source and display the ordernumber in the detail row and see how many ordernumbers come back?

The reason I am asking you to do this is because if there are several rows in the OrderHed and it’s not 1:1 with how many rows are in the table you’re joining to… you’ll potentially see this problem. Seeing the results in the orderhed table will help to determine if this is happening.

yes

^smart. Add a 5th line and reprint. does it multiply by 5? If so, check joins/grouping.

New update. I figured out “what” it’s doing but not why.

It is taking the number of lines and multiplying that by the quantity.

Example:
Pack slip has seven lines

It is then multiplying the number of lines by the quantity.

I think this calculated field has something behind it which I can’t see. Is there a way to see the code behind these?

=Fields!Calc_DspLineShpQtyUom.Value

Tammy, if it doesn’t do this on the base form and the only thing that changed on your new form is the join you made, it’s highly likely this join caused this. Would you please validate the results in the Orderhed Table? If you need help doing that, I can take a teams call, since I already explained what we’ll be doing in that teams meeting in my post above asking you to query the OrderHed table.

image

and that’s in the detail row? Like not grouped or =First(OrderHed_OrderNum)?