Add InvcHead Plant field to Customer Statement form

Looking to add the InvcHead.Plant field to the Customer Statement but can’t seem to get it to work. We have a modified version of the form, and here’s the query:

=“SELECT T1.CustID,T1.EMailAddress,T1.FaxNum,T1.Calc_AgeLabel1,T1.Calc_AgeLabel2,T1.Calc_AgeLabel3,T1.Calc_AgeLabel4,T1.Calc_AgeLabel5,T1.Calc_AgeLabel6,T1.Calc_BillToAddress,T1.Calc_BTContactName,T1.Calc_StatementComment,T1.Calc_StatementDate,T1.SalesRep_EMailAddress,T1.SalesRep_FaxPhoneNum,T1.SalesRep_Name, CAST( T2.CustNum as nvarchar ) as CustNum,T2.Company,T2.CurrencyCode,T2.DebitNote,T2.CreditMemo,T2.DNCustNbr,T2.DocInvoiceAmt,T2.DocInvoiceBal,T2.DocWithholdAmt,T2.DueDate,T2.InvoiceDate,T2.InvoiceNum,T2.InvoiceSuffix,T2.PONum,T2.Calc_CurrSymbol,T2.CurrencyCode_CurrDesc,T2.InvoiceType, T3.Company as CashDtl_Company,T3.CheckRef,T3.DocTranAmt,T3.InvoiceNum as CashDtl_InvoiceNum,T3.InvoiceRef,T3.TranDate,T3.TranType,CAST( T3.CustNum as decimal ) as CashDtl_CustNum,T3.Calc_DisplayAmount,T3.Calc_Reversed,T3.Calc_IsCM
FROM Customer_” + Parameters!TableGuid.Value + " T1
LEFT OUTER JOIN InvcHead_" + Parameters!TableGuid.Value + " T2
ON T1.Company = T2.Company AND T1.CustNum = T2.CustNum
LEFT OUTER JOIN CashDtl_" + Parameters!TableGuid.Value + " T3
ON T2.InvoiceNum = T3.InvoiceNum"

How can I add the plant field?

Thanks.

Add “T2.Plant,” just before the “T1.CustId” to get “T2.Plant,T1.CustId”
(or really any where before the table reference begins"
and then add the FIELD to dataset in the SSRS report

Changed the query, added the field but it didn’t work. Got this error:

Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: 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 ‘Customer_InvcHead_CashDtl’. —> System.Data.SqlClient.SqlException: Invalid column name ‘T2’.
Invalid column name ‘Plant’.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Ice.Core.SsrsReportService.ReportExecutionService.Render(String Format, String DeviceInfo, String& Extension, String& MimeType, String& Encoding, Warning[]& Warnings, String[]& StreamIds)
at Ice.Core.SsrsReporting.SsrsReportRenderer.Render(SsrsRenderInformationBase renderInformation)
at Ice.Core.SsrsReporting.ReportProcessorBase1.RenderReportForPreviewOrClientPrint(SysRptLst sysRptLstRow) at Ice.Core.SsrsReporting.ReportProcessorBase1.ProcessReportPart(String reportLocation, Action1 modifySysRptLstRow) at Ice.Core.RptBase.ReportSsrsDatabaseBuilder1.ProcessReportWithDataInPlace(SqlConnection connection)
at Ice.Core.RptBase.ReportDatabaseBuilder`1.XMLClose()
at Erp.Internal.AR.CustomerStatement.RunProcess(Int32 instanceTaskNum, String outputFileName)
at Ice.Hosting.TaskCaller.ExecuteTask()
at Ice.Services.Lib.RunTaskSvc.RunTask(Int32 ipTaskNum)

Needed to add the field to the report definition. But got it now! Thanks so much!

:slight_smile: yeah that too!
good work