IgnoreFilterParameter ignored when referenced field isn't in source data

I have a data structure that has several filters, one of them is set with IgnoreFilterConstant=null. This condition is ignored when the source XML doesn’t contain the field that is mapped for the filter.

Is there any way how to model this?

2024-03-13 12:17:10,479 [19] ERROR Origam.DA.Service.DataLoader - The parameterized query '(@Vehicle_parId uniqueidentifier,@Site_parId uniqueidentifier,@S' expects the parameter '@Site_parId', which was not supplied., SQL: SELECT [Vehicle].[LastSupplier] AS [LastSupplier], [Vehicle].[Id] AS [Id], [Vehicle].[RecordUpdatedBy] AS [RecordUpdatedBy], [Vehicle].[RecordCreated] AS [RecordCreated], [Vehicle].[LastProduct] AS [LastProduct], [Vehicle].[WeightDate] AS [WeightDate], [Vehicle].[WeightWeighingNumber] AS [WeightWeighingNumber], [Vehicle].[RecordCreatedBy] AS [RecordCreatedBy], [Vehicle].[LastDriver] AS [LastDriver], [Vehicle].[Note] AS [Note], [Vehicle].[LastHaulier] AS [LastHaulier], [Vehicle].[IsInactive] AS [IsInactive], [Vehicle].[LastWeighingType] AS [LastWeighingType], [Vehicle].[LastCustomer] AS [LastCustomer], [Vehicle].[LicensePlate] AS [LicensePlate], [Vehicle].[LastSite] AS [LastSite], [Vehicle].[Weight] AS [Weight], [Vehicle].[RecordUpdated] AS [RecordUpdated] FROM [Vehicle] AS [Vehicle] WHERE  (  (@Vehicle_parId = [Vehicle].[Id]))
System.Data.SqlClient.SqlException (0x80131904): The parameterized query '(@Vehicle_parId uniqueidentifier,@Site_parId uniqueidentifier,@S' expects the parameter '@Site_parId', which was not supplied.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.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.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
   at Origam.DA.Service.DataLoader.Fill() in D:\a\1\s\backend\Origam.DA.Service\AbstractSqlDataService.cs:line 157

What do you mean by

Is this the example you have in mind?

Source XML:

<ROOT>
  <Entity Id="abc"/>
</ROOT>

Your XPath mapped to your parameter

/ROOT/Entity/@SomeAttribute

Then this is always the case when SomeAttribute is null – it is vacant from the source XML. Then your filter should be ignored.

That is exactly the case. It turned out that it didn’t work because the filter set wasn’t set as dynamic.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.