FilterMode = CheckBoxList generates incorrect SQL Server query

The issue appears to be when switching from FilterMode = "Advanced" to "CheckBoxList". When in "Advanced" mode, queries are produced with the correct NULL comparison syntax e.g. "CASE WHEN [c].[CountryID] IS NOT NULL" etc..

When using the CheckBoxList mode, the same query is produced using "CASE WHEN [c].[CountryID] <> NULL" which will always return false.

I have attached a step by step guide to reproducing this but in almost all instances, I have just accepted default settings. I can include the entire solution is required but it's very easy to reproduce.

Radzen Blazor Studio NULL comparison bug.zip (324.1 KB)

I've tried our Sample database with null value for Orders -> UserName column and here is what I've got:


The query:

Here is the same for OrderDetails -> OrderId:

Hi Vladimir,
Thanks for responding. There are no NULL values in the table, this issue is the query that is generated for the filtered results, not the query to fetch the list of distinct values to show in the dropdown. If you look at the file I attached, you'll see the difference between the two queries. The Advanced Filter generates the correct query to fetch the filtered results with two selections made, but the 'same' filter using the CheckBoxList mode generates invalid SQL Server code as it generates the where clause with "[filteredcolum] <> NULL" instead of [filteredcolumn] IS NOT NULL.

I'm happy to do a screen share to demo the issue if that would help.

This is exactly what it was shown in my post. To provide further support on this issue we will need an application along with a database that demonstrates the problem. You can share it on info@radzen.com.

Was there a solution to this? I have the same (I think) issue. Switching from Advanced to CheckBoxList, I cannot query based on the results as I used to.

  public void LoadData(LoadDataArgs args)
  {
        var query = [get models].AsQueryable();

        if (!string.IsNullOrEmpty(args.Filter))
            query = query.Where(args.Filter);

        if (!string.IsNullOrEmpty(args.OrderBy))
            query = query.OrderBy(args.OrderBy);

 }

Not sure what’s the problem. I’ve just tested CheckBoxList type filtering in this demo and everything worked as expected:

I found my problem. The grid settings were saved when I was using Advanced. Then I switched to CheckBoxList. The settings saved when using Advanced would try to load and then crash. I had to remove the settings manually, because the grid/page wouldn't even load to where the user can clear the settings. Any thoughts on how to remedy that?

CheckBoxList filter type works with different filter operators and different value types (collections not single values). You might need to manually handle save/load of settings depending on the filter type however I’m not sure how practical is that since most probably your users cannot change the filter type.

User cannot change filter type. But when I release this update for the first time, their saved settings will cause an error. It doesn't sound like anything is there to really support this issue. So I will figure something out.

thanks

I already answered in my previous reply: