BAQ Error

,

I am trying to add JobMtl to JobOper (Left Outer Join). When I bring out the JobProd.Description I get this error:

Ice.Common.EpicorServerException: Conversion failed when converting the nvarchar value 'MT' to data type int. ---> System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value 'MT' to data type int.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
   at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
   at System.Data.SqlClient.SqlDataReader.Read()
   at Ice.Blaq.Execution.PagedReader.Read() in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\PagedReader.cs:line 178
   at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
   at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
   at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
   at System.Data.DataTable.Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler)
   at Ice.Blaq.Execution.QueryExecutor.LoadTableRows(IDataReader rdr, DataTable table, Int32 offset, Int32 rowsToLoad, Int32& rowsRead) in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\QueryExecutor.cs:line 464
   at Ice.Blaq.Execution.QueryExecutor.PrepareSimplePage(IDataReader rdr, IDbCommand cmd, DataTable table, QueryInfo queryInfo, Int32 offset, Int32 rowsToLoad, Boolean needTotal, Boolean isSearchPaging, Action`1 readerIncrement) in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\QueryExecutor.cs:line 414
   at Ice.Blaq.Execution.QueryExecutor.ProcessResults(IDataReader rdr, IDbCommand cmd, DataTable table, QueryInfo queryInfo) in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\QueryExecutor.cs:line 312
   at Ice.Blaq.Execution.QueryExecutor.FillResultToResultsTable(IDataReader rdr, IDbCommand cmd, DataTable resultTable, QueryInfo queryInfo, Action`1 afterFillResultTable) in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\QueryExecutor.cs:line 248
   at Ice.Blaq.Execution.QueryExecutor.FillResultDataset(IDataReader rdr, IDbCommand cmd, DataSet resultDs, QueryInfo queryInfo, Action`1 afterFillResultTable) in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\QueryExecutor.cs:line 181
   at Ice.Blaq.Execution.QueryExecutor.ExecuteAndFillDataSetInternal(IDbConnection dbconn, QueryInfo queryInfo, DataSet resultDataset, Action`2 perfLogger) in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\QueryExecutor.cs:line 118
   at Ice.Blaq.Execution.QueryExecutor.<>c__DisplayClass3_0.<ExecuteAndFillDataSet>b__0(IDbConnection dbconn) in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\QueryExecutor.cs:line 37
   at Ice.Blaq.Execution.QueryExecutionHelper.DoJobWithObject[TObj](Func`2 theJob) in C:\_releases\ICE\ICE3.2.700.11\Source\Server\Internal\Lib\Ice.Lib.Blaq\Execution\QueryExecutionHelper.cs:line 195

@Will79 , you mention three different tables in your post. JobMtl, JobOper, and JobProd. Can you please clarify the issue?

Can you post your BAQ?

Y9u need to Jon oprseq from joboper table to related op on the jobmtl table

Andrew Fagan
afagan@sonasgrp.com
617-335-0505

testing.baq (21.8 KB)

Here is the baq. After I add the JobProd.Description I get the above error.

You’re joining on JobOper.OpCode = JobMtl.RelatedOperation OpCode is nvarchar(8) and RelatedOperation is int.

I think what you’re wanting to join on is JobOper.OprSeq = JobMtl.RelatedOperation

Thanks! I need to take a nap!