I am using `Syncfusion.Blazor.DataOperations.PerformFiltering` for my filtering on DataManagerRequest.Where fields provided by the SfGrid.
However, I am encountering an error when the user does not enter anything in for a filtered datetimeoffset column:
When this is applied, I get the following error thrown:
```
System.ArgumentException: Argument types do not match
at ConstantExpression System.Linq.Expressions.Expression.Constant(object value, Type type)
at ValueTuple
at Expression Syncfusion.Blazor.Data.QueryableExtensions.Predicate(IQueryable source, object constValue, FilterType filterType, FilterBehavior filterBehaviour, bool isCaseSensitive, Type sourceType, Type memberType, Expression memExp, ParameterExpression paramExpression, string propertyName) x 2
at Expression Syncfusion.Blazor.Data.QueryableOperation.PredicateBuilder
at IQueryable
at IQueryable
at ValueTask
```
This appears to be due to the fact that the `value` value on the corresponding WhereFilter object for the provided column is null:
For further context the code used to call PerformFiltering may be found here:
https://github.com/DragonSpark/Framework/blob/master/DragonSpark.Syncfusion/Queries/Where.cs#L21
Thank you for any guidance/suggestions you can provide.
Hi Mike,
Greetings from Syncfusion support.
From your query, we prepared sample based on your requirement and filtered the
datetimeoffset column. But we’re unable to reproduce a reported exception from
our end. We have attached sample for your reference. We request you to share
the issue reproducible runnable sample or reproduce a reported issue in the
provided sample. It’ll be helpful to validate further at our end and provide solution as
earlier as possible from our end.
Regards,
Sarvesh
Thank you very much for your investigation and providing the sample project, Sarvesh. Please change your Date column to the following:
```
<GridColumn Field=@nameof(Order.Date) HeaderText="DateTimeOffset" Width="150"
FilterSettings="@(new FilterSettings { Operator = Operator.GreaterThanOrEqual, Type = Syncfusion.Blazor.Grids.FilterType.Menu })"></GridColumn>
```
Thanks for the update,
Regarding the issue you reported, we recommend checking the nullable value in
the DateTimeOffset property within your project. By ensuring that the nullable
property is properly handled, you can prevent the issue from occurring. To help
you with this, we have included a code snippet below for your reference.
|
public class Order { public int OrderID { get; set; } public string CustomerID { get; set; } public double? Freight { get; set; } public DateTimeOffset? Date { get; set; } }
|
Thank you for the suggestion Prathap. I am a little confused, however, why this is not an issue when I do not set the column `FilterSettings` property directly. That is, why is it working in the example you provided but not in the one that I provided?
Please note that changing the property in my case would mean changing my EFCore model which would result in a database change.
Thank you for any further context/assistance you can provide.
Hi Prathap thank you for any update you can provide. This seems like a bug that needs to be addressed. Any consideration is appreciated.
Hi Mike-E,
Sorry for the delay and inconvenience caused.
Mentioned issue reproduced at our end, we’ll currently validating your query at
our end. We’ll confirm with development team and provide the bug details within
two business days. Until then, we appreciate your patience.
Regards,
Sarvesh
Hi Mike-E,
We have considered it as a bug and logged an issue “Exception Occurs While Filtering the DateTimeOffSet Column” for the same. Thank you for taking the time to report this issue and helping us to improve our product. At Syncfusion, we are committed to fix all validated defects (subject to technological feasibility and Product Development Life Cycle) and this fix will be included in our upcoming patch release.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
https://www.syncfusion.com/feedback/44937/exception-occurs-while-filtering-the-datetimeoffset-column
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization”
Until then we appreciate your patience.
Regards,
Sarvesh
Thank you very much for your efforts and collaboration, Sarvesh and team! Everyone there is doing really great work and I appreciate it greatly.
Thank you so much:) We will update you on the fix once it is released.
Hi Mike,
We are glad to announce that, we have included the fix for the issue “Exception Occurs While Filtering the DateTimeOffSet Column” in our 22.1.39 release. So please upgrade to our latest version of the Syncfusion package to resolve the reported issue.
NuGet: https://www.nuget.org/packages/Syncfusion.Blazor.Grid
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Sarvesh