We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

QueryBuilder with DatePicker - throws error "Cannot read property 'match' of null"

Hello
I have a QueryBulder with 3 filters, two of them are of datatype string, and the last one of type date. The QueryBuilder is not bound to any data source.
I'm trying to get the filters/query generated by the component at runtime as follow:

//get the query builder object using the component's id
predicate = queryBuilderComponent.getPredicate(queryBuilderComponent.rule);
if (ej.base.isNullOrUndefined(predicate)) {
     dataManagerQuery = new ej.data.Query();
} else {
     dataManagerQuery = new ej.data.Query().where(predicate);
}

I get the following error whenever the getPredicate method is called (line 2 in the code above).
I noticed that if I select any value in the date picker corresponding to the 3rd filter (of type date), then I do not get the error.
Any ideas what I'm doing wrong ?
Thanks !

3 Replies

VK Vinoth Kumar Sundara Moorthy Syncfusion Team April 29, 2019 01:54 PM UTC

Hi Moez, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported issue and we suspect that you have not specified the date ‘value’ in the QueryBuilder rule caused this error. Please check the below code example to resolve the reported issue in your end, 
 
[QueryBuilderController.cs] 
new QueryBuilderRule { Label="First Name", Field="FirstName", Type="string", Operator="startswith", Value = "Sam" }, 
                    new QueryBuilderRule { Label="Title", Field="Title", Type="string", Operator="equal", Value = "Sales Manager" }, 
                    new QueryBuilderRule { Label="Hire Date", Field="HireDate", Operator="equal", Type="date", Value = "29/04/2019" } 
 
 
Could you please check the above sample and get back to us, if you still need any further assistance on this? 
 
Regards, 
Vinoth Kumar S 



MO moez April 29, 2019 08:21 PM UTC

Great, thanks Vinoth !
I'll add the data type and the default value and try again.


VK Vinoth Kumar Sundara Moorthy Syncfusion Team April 30, 2019 04:48 AM UTC

  
Hi Moez, 
 
Thank you for your update. We will be waiting to hear from you. 
 
Regards, 
Vinoth Kumar S 


Loader.
Live Chat Icon For mobile
Up arrow icon