Filter between dates

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Filter between dates

Postby m0nkey » Thu May 02, 2019 11:15 pm

Ok. i throw up the white flag for now. just need a little help if anyone can assist.

I have a query that runs great in mysql and in vici filters i can run them separate. if i add the AND operator, it doesnt return anything in filter preview but i know it will return something, as i can see plenty in mysql directly. i think its a fairly basic query but its kicking my a$$.

my query is as follows in mysql:

select count(*) from vicidial_list where date(entry_date) > date(CONCAT(DATE_ADD(CURDATE(), INTERVAL -30 DAY),' ',CURTIME())) and date(entry_date) < date(CONCAT(DATE_ADD(CURDATE(), INTERVAL -15 DAY),' ',CURTIME()));

basically just want the leads from 15 to 30 days from today.

i have tried this too:
date(entry_date) between date(CONCAT(DATE_ADD(CURDATE(), INTERVAL -30 DAY),' ',CURTIME())) and date(CONCAT(DATE_ADD(CURDATE(), INTERVAL -15 DAY),' ',CURTIME()))

and this:
date(entry_date) > date(CONCAT(DATE_ADD(CURDATE(), INTERVAL -30 DAY),' ',CURTIME())) and date(entry_date) < date(CONCAT(DATE_ADD(CURDATE(), INTERVAL -15 DAY),' ',CURTIME()))

and even this crazy thing:
((date(entry_date) in (select date(entry_date) from vicidial_list where date(entry_date) < date(CONCAT(DATE_ADD(CURDATE(), INTERVAL -15 DAY),' ',CURTIME()))))
and
(date(entry_date) in (select date(entry_date) from vicidial_list where date(entry_date) > date(CONCAT(DATE_ADD(CURDATE(), INTERVAL -30 DAY),' ',CURTIME())))))


I've thrown in more parenthesis in these things than i can express. If anyone has an idea on how to get more than 15 days but less than 30, please throw me a bone.

thanks ahead.
VERSION: 2.14-705a BUILD: 190327-2311 | Asterisk 13.21.1-vici | Single Server No Digium/Sangoma Hardware | No Extra Software After Installation
m0nkey
 
Posts: 3
Joined: Thu Jan 22, 2015 11:55 am

Re: Filter between dates

Postby blackbird2306 » Fri May 03, 2019 5:46 am

Put this into your filter SQL field:

Code: Select all
(DATE_SUB(`entry_date`, INTERVAL -15 DAY) <= CURDATE() AND DATE_SUB(`entry_date`, INTERVAL -30 DAY) >= CURDATE())


These both conditions are logically different:
m0nkey wrote:basically just want the leads from 15 to 30 days from today.

which means >= 15 and <= 30 (in my example I assumed you mean this one)
but
m0nkey wrote:If anyone has an idea on how to get more than 15 days but less than 30, please throw me a bone.

means: >15 and <30
Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.12-560a build: 160617-1427 | Asterisk 1.8.32.3
blackbird2306
 
Posts: 409
Joined: Mon Jun 23, 2014 5:31 pm


Return to Support

Who is online

Users browsing this forum: Google [Bot] and 88 guests