Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Comparing two date fields

leech10
Tera Contributor

Hi

 

I need a query to compare 2 dates and they cannot be the same. basically they cannot be equal.  Below is working but only when days/months/years differs. When seconds, minutes or hours it is not working. Report displays records whereas it should not. Encoded query works the same. 

grPrjT.addQuery('end_date','NSAMEAS', 'u_latest_baseline_date')

 

Could you please advise what query should I use in this case

 

Regards

Piotr

7 REPLIES 7

SumanthDosapati
Mega Sage
Mega Sage

Hi,

You can apply Same As filter from year to hour level only. Not minutes and seconds.

Sample Encoded query would be:

fieldonwSAMEASfieldtwo@hour

 

Hi

 

I used this:

 

grPrjT.addEncodedQuery('work_startNSAMEASu_latest_baseline_date@hour');

 

This is not working at all. I am working in Graphs4U

 

 

leech10
Tera Contributor

Hi

I used this and it is not working at all. I am doing reports in Graphs4U. 

grPrjT.addEncodedQuery('work_startNSAMEASu_latest_baseline_date@hour');

leech10
Tera Contributor

Hi

 

I used this:

 

grPrjT.addEncodedQuery('work_startNSAMEASu_latest_baseline_date@hour');

 

This is not working at all. I am working in Graphs4U