How to use the new Filter component to create an SQL query

1 Answer 27 Views
General Discussions
Fabrizio
Top achievements
Rank 1
Fabrizio asked on 03 Mar 2022, 11:44 AM | edited on 03 Mar 2022, 05:18 PM

Good morning all,

I'm taking a look to the new Filter component, recently added to Telerik UI for Blazor.

I'm using it to build conditions to send to a custom SQL Query generator which will build the where clauses mapping from the export of the filter component.

At the moment I'm simply serializing the CompositeFilterDescriptor to JSON obtaining something like this:

{
    "FilterDescriptors": [{
            "Operator": 4,
            "Member": "Quantity",
            "Value": 25
        }, {
            "Operator": 1,
            "Member": "Quantity",
            "Value": 40
        }, {
            "Operator": 2,
            "Member": "OrderShipCountry",
            "Value": "France"
        }, {
            "FilterDescriptors": [{
                    "Operator": 17,
                    "Member": "OrderShipName",
                    "Value": "La maison d\u0027Asie"
                }, {
                    "Operator": 18,
                    "Member": "OrderShipName",
                    "Value": "Victuailles en stock"
                }
            ],
            "LogicalOperator": 1
        }
    ],
    "LogicalOperator": 0
}

and I will have the Query Generator parse it, but if there are better strategies, please let me know.

Thanks, have a nice day.

PS: I tagged this question as General Discussion as it seems like a "Filter" tag is not available yet.

Lane
Top achievements
Rank 1
commented on 05 May 2022, 04:21 PM

Did you get this working? Would you be willing to share the details of the Query Generator? Thanks.

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 06 Mar 2022, 03:55 PM

Hi Fabrizio,

That's a valid approach.

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Fabrizio
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or