Operators?

Hi,

We're trying to understand when adding an Or operator between 2 conditions where is this stored?  We have 2 rules but can't see where the Or (or And) operators are stored ?  We need to save the conditions to a database to use. 

Also, how can we distinguish between And and Or conditions in the UI, can we add a css style to do this.  Thanks.


Looking at your sample "Or" doesn't seem to have any effect and conditions are always "And" - https://blazor.syncfusion.com/demos/query-builder/grid?theme=bootstrap4



2 Replies 1 reply marked as answer

AS Aravinthan Seetharaman Syncfusion Team February 2, 2021 03:12 AM UTC

Hi Alex, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your reported query with provided details. 
 
Query :  where the Or (or And) operators are stored ? 

Ans: Condition operators are stored under Querybuilder.Rule.Condition. For your reference we provided code snippets and sample here. 
 
 
<SfQueryBuilder TValue="EmployeeDetails" DataSource="@EmployeeData" @ref="QueryBuilderObj"> 
    <QueryBuilderRule Condition="or" Rules="Rules"></QueryBuilderRule> 
    <QueryBuilderEvents TValue="EmployeeDetails" Created="created" RuleChanged="RuleChange"></QueryBuilderEvents> 
    <QueryBuilderColumns> 
        <QueryBuilderColumn Field="EmployeeID" Label="Employee ID" Type="ColumnType.Number"></QueryBuilderColumn> 
    </QueryBuilderColumns> 
</SfQueryBuilder> 
 
@code{ 
 public void created() 
   
        Condition = QueryBuilderObj.Rule.Condition; 
   
    public void RuleChange() 
   
        RuleModel rule = QueryBuilderObj.GetRulesFromSql(); 
        Condition = rule.Condition; 
   
 
 
 
Could you please check the above details, and get back to us, if you need assistance on this. 
 
Regards, 
Aravinthan S 


Marked as answer

AS Aravinthan Seetharaman Syncfusion Team February 2, 2021 04:58 PM UTC

Hi Alex, 
  
Query 2: how can we distinguish between And and Or conditions in the UI, can we add a css style to do this? 
 
Ans: By using below CSS we can apply different colors to AND/OR condition operators. 
 
 
.e-query-builder 
    .e-btn-group 
    input:checked + label.e-btn.e-btngroup-and-lbl
        background-color: green; 
   
 
    .e-query-builder 
    .e-btn-group 
    input:checked + label.e-btn.e-btngroup-or-lbl
        background-color: blue; 
   
 
 
Query 3: Looking at your sample "Or" doesn't seem to have any effect and conditions are always "And"? 
 
Ans: We have checked the query, and we cannot reproduce reported in our end. If possible, try to reproduce the reported issue in provided sample or share the issue reproducible sample. 
 
Could you please check the above details, and get back to us, if you need assistance on this. 
 
Regards, 
Aravinthan S 


Loader.
Up arrow icon