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

where clause formating with selecting Blanks in excel filter

Hello,

I am using my custom parameters for filtering grid by adding same structure as normal where request clause. If I have column with type date or datetime and with excel filter I am removing check box from Blanks - I am getting different normal where clause requests to webAPI.

If I am not pushing my additional parameters, I am getting this structure:


If I am adding my additional parameters, I am getting this structure:


In second case I am getting incorrect data when I am expanding excel filter again (no of other dates is selected and also other column filters show No records to display, but I am getting data for them):



I am not doing anything with normal where clause - I am only pushing my additional parameter with structure. I am attaching my method for adding additional parameters (for my needs this method works correctly but somehow it affects normal where clause)

Attachment: method_5f3892f9.zip

13 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team July 4, 2019 10:09 AM UTC

Hi AC, 

Thanks for contacting Syncfusion support. 

We have validated the provided information and if you want to generate predicate for complex filtering then we suggest you to use the below way instead of pushing predicate into where query. 


If the above does not resolve the problem then share the below details that will helpful for us to validate further at our end. 

  1. Did you want to use your own custom filtering instead of default filter
  2. Or you need send only the additional parameter while filtering?
  3. Share your full requirement and code example that will helpful to proceed further.

Regards, 
Thavasianand S. 



UN Unknown Syncfusion Team July 22, 2019 11:26 AM UTC

Hello,

1. Yes I want to use my own filtering parameters and not use it with setting predicates.
2. I am doing my filtering by passing my additional parameters almost similar structure as default where clause
3. My code for adding additional parameters where attached in previously asked question in this thread.

I am only wondering how my additional parameters can have influence for default where clause structure? I am not doing anything with default where clause but as can you see in previous question - I see different where clause structure while I am additional my additional parameter and while not using my additional parameter.


TS Thavasianand Sankaranarayanan Syncfusion Team July 26, 2019 12:43 PM UTC

Hi AC, 

Thanks for your update. 

We have validated the provided information and checked with our end and its working fine at our sample(it does not affect the default where structure). Please refer the below sample for more information. In the below sample, we have apply additional parameters to grid while perform filtering.  


We suspect that due to the object reference(assign from filterSettings) might cause the problem so please check and ensure this at your end(command addParams line only and check it once if you still face the problem then it’s because of the object reference). If you still face the problem then share the sample or hosted link or reproduce the reported problem at our sample that will be more helpful for us to validate further at our end. 

Regards, 
Thavasianand S.  



UN Unknown Syncfusion Team August 11, 2019 08:24 AM UTC

Hello,

thank you for help. My problem is finally solved!

My problem was that I was changing filterSettings property type because in some cases it is undefined. So this change affects filtering settings structure.


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team August 12, 2019 07:42 AM UTC

Hi AC,  

Thanks for your update.  

We are happy to hear that your requirement has been resolved and you are good to go.  

Please get back to us, if you require further assistance on this.  

Regards,  
Seeni Sakthi Kumar S. 



UN Unknown Syncfusion Team June 29, 2020 11:34 AM UTC

Hello,

I renewed grid version to latest (18.1.57) and after that I am getting incorrect data with my additional parameters while sending them to WebAPI. I do not change my code that was working with version 17.1.48 but now I am getting different data.

I am trying to send my own filters to WebAPI and am getting incorrect dates when I am adding it to parameters (this is data while I am console log it before request to WebAPI):


But I am getting different data in request:

Somehow these dates are with added 2 hours (I think because of GMT+2), but I do not know why because I am passing these dates like string format.

Maybe there are some settings or other solution to avoid this problem?



BS Balaji Sekar Syncfusion Team July 1, 2020 10:05 AM UTC

Hi AC, 
 
Before proceeding further, we need additional information about the reported problem so, please share the below details to us that will help to validate further. 
 
  1. Share code definition of the addParams( “validFromDate”).
  2. Share video demonstration of the problem.
  3. Share Grid sample, if possible
 
Regards, 
Balaji Sekar 



UN Unknown Syncfusion Team July 7, 2020 07:06 AM UTC

Hello,

I am sending my methods where I am adding my own parameters to send to WebAPI. These methods are called when I am filtering data in my grid using Excel filter.

When I am logging data on date type field I am getting correct data:


But in request sent to WebAPI I see different values:


Also I tried to add my code to stackBlitz, but in my case I am using UrlAdaptor to get data from WebAPI but in example there are WebApiAdaptor so there need to do changes to get check if it is also not working like in my case: https://stackblitz.com/edit/angular-7w2zci-ljzffw?file=app.component.ts (I added my code on Grid Remote data example from Syncfusion demos page).

Attachment: methods_own_filters_d47629e5.zip


BS Balaji Sekar Syncfusion Team July 8, 2020 10:35 AM UTC

Hi AC, 
 
Thanks for your update. 
 
We have validated your query with provided the information but we are facing “moment is not function” script error while filtering any column of Grid since we cannot reproduce the reported problem and filter is not working properly. 
 
We will wait for your update and please share the reported problem in sample without error. 
 
Regards, 
Balaji Sekar 



UN Unknown Syncfusion Team July 9, 2020 09:09 AM UTC

Hello,

sorry for the mistake. I am sending my example without errors. In example with console.log() in line 227 you can see that I have one dates while in POST request UrlDatasource I have other dates with +2 hours:
Console data:

POST request data:


You can get this while filtering first column (Order Date).

StackBlitz example: https://stackblitz.com/edit/angular-7w2zci-mes9sh?file=app.component.ts 


BS Balaji Sekar Syncfusion Team July 10, 2020 05:58 AM UTC

Hi AC, 
 
Thanks for your update 
 
Query: Date predicate value included with 2 hours while pass that value to server using  addParams. 
 
This issue may occurred in time Zone problem. 
 
Now, we have provided the support Date value in UTC time with local time zone based on Date standardization. We suggest you to use the following way to achieve the UTC time zone alone in the Date column. Please refer the below code example and image. 
 
[app.component.ts] 
load() { 
        DataUtil.serverTimezoneOffset = 0; // Set the UTC time in serverTimezone 
    } 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Balaji Sekar 



UN Unknown Syncfusion Team July 10, 2020 12:04 PM UTC

Hello,

as I see in your example - the result is still incorrect like in my example. I tried to add it to my application and after that I am getting +4 hours.


SK Sujith Kumar Rajkumar Syncfusion Team July 13, 2020 11:26 AM UTC

Hi AC, 

On performing the filter operation, the data sent in the server request will be stringified using the JSON’s stringify method which will change the date values based on the local time zone as in below image, 
  
     
So in order to avoid this the UTC conversion time is added to the date values prior to the stringify function in the source-level so that the selected value will be returned in the request. This is why the date values sent through the params are modified based on the time zone. This is the default behavior, so if you need to avoid this then you achieve it by adding/reducing the date value based on your time zone before adding it to the Predicates sent through the grid params. 
 
Let us know if you have any concerns. 
 
Regards, 
Sujith R 


Loader.
Live Chat Icon For mobile
Up arrow icon