AST Node Builder and evaluating with Query builder or Aggration Formulas

Hi,


I wonder can make an AST Builder using Syncfusion blazor query builder. For example, the following .net libraries help me create and evaluate AST nodes.

And my second question is can i create aggreation func. rules like SUM, MAX, MIN, AVG, COUNT etc.

Basically i want to build decesion engine based on this rules.

Basic scenario :

  1. Check if any transaction exceeds €150,000.
  2. Check if the total amount of this month's transactions is 150% of the previous month's total amount.
  3. Check if any transaction was sent to a blacklisted country.
  4. Check if the user has been a customer for more than 2 years.


Thanks.


3 Replies 1 reply marked as answer

YA YuvanShankar Arunagiri Syncfusion Team December 16, 2024 12:05 PM UTC

Hi Muhammet,


Sorry for the delay. We have checked your reported query, and for more clarification, based on Query Builder architecture, we have prepared only the WHERE value of the SQL query from the Blazor Query Builder using the GetSqlFromRules method. Using those SQL values, we can frame the SQL query like shown below.


var condition = QueryBuilderObj.GetSqlFromRules(QueryBuilderObj.GetRules());

 

SELECT MAX(column_name)

    FROM table_name

    WHERE condition;


Please note that in SQL, aggregate functions such as SUM, MAX, and MIN are designed to operate on the result set after aggregation. They are typically used within the SELECT statement to perform calculations or in combination with the GROUP BY clause to group and analyze data.


However, aggregate functions cannot be used directly in the WHERE clause. The WHERE clause is applied before any aggregation occurs and is intended to filter rows at the dataset level. Attempting to use aggregate functions in the WHERE clause will result in an error.


Regards,

YuvanShankar A


Marked as answer

MS Muhammet Sahin January 2, 2025 08:31 AM UTC

Thank you for your answer.



YA YuvanShankar Arunagiri Syncfusion Team January 2, 2025 12:47 PM UTC

You are welcome, Muhammet. Please get back to us if you need any further assistance on this.


Loader.
Up arrow icon