how to retrieve data from two and three days ago?

rjp
Tera Expert

Hi Gurus,

Is it possible to retrieve data that has an updated date equal to Yesterday AND two days ago AND three days ago.

I see there are built-in options for today, yesterday, last 7 days etc, but that goes back to far.  I just need for the past three days.  

Let me know if you think this is possible.

Thanks,

Rob

1 ACCEPTED SOLUTION

try now

 

usrCount = new GlideRecord("sn_imt_quarantine_unanswered_health_status_user");
usrCount.addEncodedQuery('u_unanswered_dateRELATIVELT@dayofweek@ago@3^u_unanswered_dateRELATIVEGT@dayofweek@ago@4');
usrCount.query();

var userArray = [];
while(usrCount.next()){

usrCount2 = new GlideRecord("sn_imt_quarantine_unanswered_health_status_user");
usrCount2.addEncodedQuery('u_unanswered_dateRELATIVELT@dayofweek@ago@2^u_unanswered_dateRELATIVEGT@dayofweek@ago@3^u_person=usrCount.u_person.name');

usrCount2.query();

while(usrCount2.next()){


gs.log('here1');
gs.log(usrCount2.u_person.name);
userArray.push(usrCount.sys_id.toString());
}

}

View solution in original post

35 REPLIES 35

Chander Bhusha1
Tera Guru

Hi Rjp,

You have to use the relative type of condition as shown below:

updated  relative   on or after  3 days ago

find_real_file.png

 

 

Please mark answer correct and helpful

Thanks,

CB

rjp
Tera Expert

Thanks CB, so something like this should bring back if they have unanswered on all three previous days?

find_real_file.png

Hi rjp,

The conditions should be in OR conditions as you need  report on the updates on either or the 3 days like :

this can achieve through only one condition as you need the updated from past three days.

find_real_file.png

 

It will give you the records which was updated in last 3 days which include (yesterday,2days before and 3 days before).

 

 

Please mark my answer correct and helpful

Thanks,

Cb

Hi,

Using      Updated         relative       on or after       3 Days ago        should be sufficient for your requirement which will bring the data from past 3 days.

 

 

Please Mark it helpful/Correct if it helps you.

Regards,
Sravan.