I have a customized Proforma invoice form that we use for commercial invoices. On this document, I have to show the Schedule B Code, the Country of Origin, the FOB terms, and the Cust ID.
This means that I need to join a number of additional tables. I have done all of that and it mostly works, but I am getting a duplicate of the Miscellaneous Line Charges. Below are my table joins:
FROM OrderHed_" + Parameters!TableGuid.Value + " T1
LEFT OUTER JOIN OrderDtl_" + Parameters!TableGuid.Value + " T2
ON T1.Company = T2.Company AND T1.OrderNum = T2.OrderNum
LEFT OUTER JOIN OrderMsc_" + Parameters!TableGuid.Value + " T3
ON T2.Company = T3.Company AND T2.OrderNum = T3.OrderNum AND T2.OrderLine = T3.OrderLine
LEFT OUTER JOIN Part_" + Parameters!TableGuid.Value + " T4
ON T1.Company = T4.Company AND T2.PartNum = T4.PartNum
LEFT OUTER JOIN FOB_" + Parameters!TableGuid.Value + " T5
ON T1.Company = T5.Company AND T1.FOB = T5.FOB
LEFT OUTER JOIN Country_" + Parameters!TableGuid.Value + " T6
ON T1.Company = T6.Company AND T4.ISOrigCountry = T6.CountryNum
LEFT OUTER JOIN Customer_" + Parameters!TableGuid.Value + " T7
ON T1.Company = T7.Company AND T1.CustNum = T7.CustNum"
If I DELETE that last left out join of the Customer table, the duplicate miscellaneous line charges go away, but then I am not able to show the Cust ID. Is my join setup incorrect?
Similar to Calvinâs question, check the RDD first.
It has the customer table already assigned, so it should already be
Just copy it and untick âExclude Columnâ
But I donât have the Customer table linked to the OrderHed (through LinkedTables). I thought that is what my additional relationship (OrderHed2Customer) would do.
Either way, the CustID field should be available through Linked Tables⌠If you add âCustomerâ as a Picked Link, then go to the Description Fields tab it should give you a CustID.
Even though there is not a join called out in the RDD, Epicor has built the join in the background. Just add the table and join to the report query and add the field and you should be fine. Took me a long time to figure that one out. The best way to check these types of things is to run the report with retention of a day and then do a SQL query against the report DB for the tables included in the RDD.
Iâm thinking you need to do nothing but enable the field Customer.CustID (as you did), and add it to the SELECT clause of the RDL.
While you said that the RDLâs query expression doesnât have any JOINS for the customer table, you may find that the fields from the âcustomerâ table in the RDD are actually added to the OrderHed_GUID table.
Itâs a common mistake to think that the âtablesâ in an Epicor supplied RDD are the actual DB tables. Theyâre often a table with the same name, but include calculated fields and even fields from other tables.
Take a look at the SELECT clause of the RDLâs query expression, Do you see any filed names with a table name prefixed, like T1.Customer_ShipTo That would be how the Customer.ShipTo field would be referenced fromin the OrderHed_GUID table.
Iâd first try T1.CustID in the SELECT clause. Then âT1.Customer_CustIDâ
This is confusing, because a relationship between Order Header and Customer is pretty obvious, but so is the relationship between Order Header to Order Detail and a Report Relationship is shown on the standard RDD for Pro-Forma Invoice for OrderHed2OrderDtl, but NOT for OrderHed2Customer:
If I delete my created RDD Report Relationship of OrderHed2Customer, and do nothing else to my RDL file, then my duplicate Line Miscellaneous Charges go away.
It is really confusing as it does not make much sense and I donât even know why it works the way it does.
I just ran the Pro-Forma standard report and below is the list of tables that were created for the report, notice that Customer is there.
Out of the box, the CustID field is not included, so I need to create a new RDD. Once I have created the new RDD, I change the default report to use the new RDD. When I run that and then go look in the Customer table that was created, you can see the CustID is there.
Now you just need to get it into the report. Change the Dataset query of the report to include the Customer table, like this.
FROM OrderHed_" + Parameters!TableGuid.Value + " T1
LEFT OUTER JOIN OrderDtl_" + Parameters!TableGuid.Value + " T2
ON T1.Company = T2.Company AND T1.OrderNum = T2.OrderNum
LEFT OUTER JOIN OrderMsc_" + Parameters!TableGuid.Value + " T3
ON T2.Company = T3.Company AND T2.OrderNum = T3.OrderNum AND T2.OrderLine = T3.OrderLine
LEFT OUTER JOIN Customer_" + Parameters!TableGuid.Value + " T4
ON T1.Company = T4.Company AND T1.CustNum = T4.CustNum"
Add the field in the Dataset query and properties too and you now have the field available and no duplications.
And tables created in the Report DB, may not have a one-to-one correlation with datasources in the RDL. As seen in this very example (there is no OHOrderMsc dataset in the RDL, but there is that datasource in the RDD)
And lets not even get into what happens to the datasources in the RDL if you click the dreaded âSync Dataâ button on the Report Style maintenance !
Thank you for all the help. My reports are now running without duplicating the Line Miscellaneous Charges. Now my user wants to add the Ship to contact name to the proforma invoice document.
What is the best approach? Adding a new table with new relationships?
I have tried adding the CustCnt table with the following relationship to the OrderHed:
Here is the new error message (from the System Monitor):
Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask:
Ice.Core.SsrsReportService.ReportExecutionSoapException: Exception of type âIce.Core.SsrsReportService.ReportExecutionSoapExceptionâ was thrown.
SOAP Fault: An error has occurred during report processing. â> Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during report processing. â> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Query execution failed for dataset âOrderHedâ. â> System.Exception: For more information about this error navigate to the report server on the local server machine, or enable remote errors)
Detail: rsProcessingAborted400An error has occurred during report processing.https://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Exceptions.ErrorStrings&EvtID=rsProcessingAborted&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=15.0.1102.861Microsoft SQL Server Reporting Services15.0.1102.8611033OsIndependent1033
That means somethingâs off with the dataset query of the OrderHed dataset in your RDL, but itâs not off in a way that would be caught by Report Builder (such as a syntax error)âŚ
So I rewrote my RDL Left Outer Join statement for the CustCnt table and instead of using all 4 relationship links that I used on my RDD, I only used 2:
LEFT OUTER JOIN CustCnt_" + Parameters!TableGuid.Value + " T8
ON T1.Company = T8.Company AND T1.CustNum = T8.CustNum
Then I named the datafield CustCnt_Name so I could add it in the correct location on Report Builder.
Every test I tried brought in the Ship To Contact name, so it looks like it is working.