What’s New in Blazor Query Builder: 2024 Volume 1
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (179).NET Core  (29).NET MAUI  (214)Angular  (110)ASP.NET  (51)ASP.NET Core  (83)ASP.NET MVC  (90)Azure  (41)Black Friday Deal  (1)Blazor  (226)BoldSign  (15)DocIO  (24)Essential JS 2  (109)Essential Studio  (200)File Formats  (68)Flutter  (133)JavaScript  (226)Microsoft  (120)PDF  (81)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (942)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (52)Windows Forms  (61)WinUI  (71)WPF  (163)Xamarin  (161)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (9)Business intelligence  (55)Button  (4)C#  (157)Chart  (140)Chart of the week  (54)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (70)Development  (658)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (14)Excel  (43)Extensions  (22)File Manager  (7)Gantt  (19)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (512)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (4)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (14)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (393)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (614)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
What’s New in Blazor Query Builder: 2024 Volume 1

What’s New in Blazor Query Builder: 2024 Volume 1

TL;DR: Are you searching for a way to create complex queries easily?  Syncfusion Blazor Query Builder is just what you need — a simple, graphical tool for creating queries with ease. This blog highlights the new features of the Blazor Query Builder added in the Essential Studio 2024 Volume 1 release.

The Syncfusion Blazor Query Builder is a rich and responsive UI for filtering large amounts of data by creating or editing conditions that can be combined with data visualization controls like DataGrid and Charts to view the filtered data. It outputs structured JSON filters that can be easily parsed to create SQL queries. It allows you to create and group conditions using the AND/OR logic.

This blog will explore the new features introduced to the Blazor Query Builder component in the Essential Studio 2024 Volume 1 release.

New features

The Blazor Query Builder component delivers the following new features:

Parameter SQL Query support

The Parameter SQL Query allows users to include placeholders or parameters within SQL queries, which can be dynamically filled with values during execution. This enables a more flexible and customizable approach to querying databases.

Instead of hardcoding specific values directly into the SQL query, parameters can be used to represent values that may change based on user input or other conditions.

The following new SQL query types are added in this 2024 volume release:

  • Parameter SQL
  • Named Parameter SQL

Parameter SQL: Parameters are typically represented by question marks (?) as placeholders in the SQL query string. These placeholders are positional, meaning they are replaced with parameter values based on their order when the query is executed.

Refer to the following example.

SELECT * FROM users WHERE username = ? AND age > ? 

In this query, the first ? represents the value for the username parameter, and the second ? represents the value for the age parameter. When executing the query, the parameter values will be provided in the same order as the placeholders.

Named Parameter SQL: Parameters are represented by names rather than positions. Placeholders are specified using a syntax that includes a prefix followed by the parameter name, such as :parameter_name.

Refer to the following example.

SELECT * FROM users WHERE username = :username AND age > :min_age  

In this query, the :username and :min_age are named parameters. When the query is executed, the parameter values will be bound to the named parameters based on their names. Named parameter SQL enhances readability and flexibility since parameter values can be provided in any order, maintaining clarity about the use of each parameter.

The SetParameterSql and SetNamedParameterSql methods streamline the process of importing from both Parameter and Named Parameter SQL, respectively. This can be achieved by integrating SQL queries with parameters directly into the Blazor Query Builder.

Conversely, the GetParameterSql and GetNamedParameterSql methods facilitate exporting to Parameter SQL and Named Parameter SQL, respectively, using the ParameterSql and NamedParameterSql classes. These methods enable the seamless incorporation of defined conditions from the Query Builder into SQL queries with parameters, enhancing flexibility and adaptability in query processing. 

Refer to the following code example.

// To set Parameter SQL.
object[] Params = new object[] { "Nancy" };
ParameterSql = new ParameterSql()
{
   Sql = "FirstName = ?",
   Params = Params
};
QueryBuilderObj.SetParameterSql(ParameterSql);

// To set Named Parameter SQL.
Dictionary<string, object> Params = new Dictionary<string, object>();
Params.Add("FirstName_1", "Nancy");
ParameterNamedSQL = new NamedParameterSql()
{
    Sql = "FirstName = :FirstName_1",
    Params = Params
};
QueryBuilderObj.SetNamedParameterSql(ParameterNamedSQL);

// To get Parameter SQL.
ParameterSQL  paramSQL = QueryBuilderObj.GetParameterSql(QueryBuilderObj.GetValidRules());

// To get Named Parameter SQL.
NamedParameterSql namedSQL = QueryBuilderObj.GetNamedParameterSql(QueryBuilderObj.GetValidRules()); 

Refer to the following image.

Parameter SQL Query support in the Blazor Query Builder
Parameter SQL Query support in the Blazor Query Builder

MongoDB Query support

A MongoDB query retrieves data from a MongoDB database, which stores data in JSON-like documents. Expressed in MongoDB Query Language (MQL), these queries operate at the document level, enabling retrieval, updating, or deletion based on specific criteria.

MongoDB queries offer powerful capabilities for precise querying and data aggregation. With optimization techniques enhancing performance, MongoDB remains a popular choice for its scalability and efficiency in various apps.

The SetMongoQuery method simplifies importing MongoDB queries directly into the Blazor Query Builder, facilitating seamless integration for dynamic querying within the app. Conversely, the GetMongoQuery method is used to export  MongoDB queries, enabling the incorporation of defined conditions from the Query Builder into MongoDB queries.

Refer to the following code example.

// To set the MongoDB query to the Blazor Query Builder.
QueryBuilderObj.SetMongoQuery('{"$and":[{"Age":29 },{ "$or":[{"FirstName":{"$regex":"^Andre"}}]}]}');

// To get the MongoDB query from the Blazor Query Builder.
string mongoQuery = QueryBuilderObj.GetMongoQuery(QueryBuilderObj.GetValidRules());
 

Refer to the following image.

MongoDB Query support in the Blazor Query Builder
MongoDB Query support in the Blazor Query Builder

Note: For more details, refer to the MongoDB and Parameter SQL queries in the Blazor Query Builder demos.

Clone support

The Blazor Query Builder now allows cloning individual rules and entire groups. Utilizing the Clone options, we can generate an exact duplicate of a rule or group adjacent to the original one. This feature enables users to replicate complex query structures effortlessly.

The QueryBuilderShowButtons directive allows users to toggle the visibility of these cloning buttons, providing convenient control over the cloning process within the Query Builder interface. You can duplicate groups and rules in the Query Builder using the CloneGroup and CloneRule methods, respectively.

Refer to the following code example to enable clone options in the Blazor Query Builder.

<div className='col-lg-12 control-section'>
  <SfQueryBuilder DataSource="@dataSource">
      <QueryBuilderRule Condition="and" Rules="@rules"></QueryBuilderRule>
      <QueryBuilderShowButtons CloneGroup="true" CloneRule="true"></QueryBuilderShowButtons>
      <QueryBuilderColumns>
          <!== Bind your columns here ==>
      </QueryBuilderColumns>
  </SfQueryBuilder>
</div>

Refer to the following image.

Clone support in the Blazor Query Builder
Clone support in the Blazor Query Builder

Note: For more details, refer to the clone support in the Blazor Query Builder demos.

Lock support

Now, you can lock individual rules or entire groups in the Query Builder.

When a rule is locked, it prevents users from modifying its field, operator, and value, effectively disabling these components. Similarly, locking a group disables all elements contained within it.

This feature offers users greater control over their query configurations, ensuring that specific rules or groups remain unchanged. Additionally, users can manage the visibility of locking buttons through the QueryBuilderShowButtons directive, allowing for seamless control over the locking mechanism.

To enforce access restrictions and prevent modifications, use the LockGroup method for all groups and the LockRule method for individual rules in the Query Builder.

Refer to the following code example to enable lock options in the Query Builder.

<SfQueryBuilder DataSource="@dataSource">
 <QueryBuilderRule Condition="and" Rules="@rules"></QueryBuilderRule>
 <QueryBuilderShowButtons LockGroup="true" LockRule="true"></QueryBuilderShowButtons>
 <QueryBuilderColumns>
   <!== Bind your columns here ==>
 </QueryBuilderColumns>
</SfQueryBuilder>
</div>

Refer to the following image.

Lock support in the Blazor Query Builder
Lock support in the Blazor Query Builder

Note: For more details,  refer to the lock options in the Blazor Query Builder demos.

Conclusion 

Thanks for reading! We hope you enjoyed this quick introduction to the new features of our Blazor Query Builder component.  If you want to give it a try, please download the latest available version of Essential Studio 2024 Volume 1

Experience the convenience of constructing database queries with our Blazor Query Builder component. It enables users to create, modify, and manage queries effortlessly without the need to write code manually. Enjoy the streamlined process of building complex queries with ease. Also, provide your valuable feedback in the comments section below.

You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!

Related blogs

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed