Filter problem with DATE_OF_BIRTHDAY

All installation and configuration problems and questions

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

Filter problem with DATE_OF_BIRTHDAY

Postby phil_discount » Fri Jul 24, 2009 9:57 am

Hello,

i'd like to filter the leads in the hopper by birthday.
but i don't know how to do that.

in the sql database the field named DATE_OF_BIRTHDAY.

my request:

only leads with birthday of today or before should be phoned.
the first leads should be the customers with the birthday today and then every customer who had birthday in the past.

DATE_OF_BIRTHDAY <= now() GROUP BY DATE_OF_BIRTHDAY

is it possible, if yes, how? ;-)

thanks a lot
best regards
philip
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Postby phil_discount » Fri Jul 24, 2009 11:07 am

UPDATE:

i found out, that the syntax have to
Code: Select all
date_of_birth < today

format in datebase for field "date_of_birth"
Code: Select all
2009-07-26
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Postby phil_discount » Wed Aug 05, 2009 7:34 am

okay, problem is solved.
my code was wrong
useful help is /usr/share/astguiclient/AST_VDhopper.pl --debugX
:-)

i use the following code
Code: Select all
day(date_of_birth) <= day(now())
AND
month(date_of_birth) <= month(now())
AND
month(now()) - month(date_of_birth) <= 1


regards
philip
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Postby phil_discount » Wed Aug 05, 2009 2:39 pm

is it possible to order the result of the filter like
Code: Select all
ORDER BY date_of_birth


log from debug

Code: Select all
','-11.75','-12.00','-12.25','-12.50','-12.75','99') ) ) and day(date_of_birth) <= day(now())
AND
month(date_of_birth) <= month(now())
AND
month(now()) - month(date_of_birth) <= 1 ORDER BY date_of_birth limit 50;|
     lead call order:      order by lead_id asc
     |SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN('102') and lead_id NOT IN('0') and ((gmt_offset_now IN('13.00','12.75','12.50','12.25','12.00','11.75','11.50','11.25','11.00','10.75','10.50','10.25','10.00','9.75','9.50','9.25','9.00','8.75','8.50','8.25','8.00','7.75','7.50','7.25','7.00','6.75','6.50','6.25','6.00','5.75','5.50','5.25','5.00','4.75','4.50','4.25','4.00','3.75','3.50','3.25','3.00','2.75','2.50','2.25','2.00','1.75','1.50','1.25','1.00','0.75','0.50','0.25','0.00','-0.25','-0.50','-0.75','-1.00','-1.25','-1.50','-1.75','-2.00','-2.25','-2.50','-2.75','-3.00','-3.25','-3.50','-3.75','-4.00','-4.25','-4.50','-4.75','-5.00','-5.25','-5.50','-5.75','-6.00','-6.25','-6.50','-6.75','-7.00','-7.25','-7.50','-7.75','-8.00','-8.25','-8.50','-8.75','-9.00','-9.25','-9.50','-9.75','-10.00','-10.25','-10.50','-10.75','-11.00','-11.25','-11.50','-11.75','-12.00','-12.25','-12.50','-12.75','99') ) ) and day(date_of_birth) <= day(now())
AND
month(date_of_birth) <= month(now())
AND
month(now()) - month(date_of_birth) <= 1 ORDER BY date_of_birth order by lead_id asc limit 50;|
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by lead_id asc limit 50' at line 5 at /usr/share/astguiclient/AST_VDhopper.pl line 1351.
executing: SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN('102') and lead_id NOT IN('0') and ((gmt_offset_now IN('13.00','12.75','12.50','12.25','12.00','11.75','11.50','11.25','11.00','10.75','10.50','10.25','10.00','9.75','9.50','9.25','9.00','8.75','8.50','8.25','8.00','7.75','7.50','7.25','7.00','6.75','6.50','6.25','6.00','5.75','5.50','5.25','5.00','4.75','4.50','4.25','4.00','3.75','3.50','3.25','3.00','2.75','2.50','2.25','2.00','1.75','1.50','1.25','1.00','0.75','0.50','0.25','0.00','-0.25','-0.50','-0.75','-1.00','-1.25','-1.50','-1.75','-2.00','-2.25','-2.50','-2.75','-3.00','-3.25','-3.50','-3.75','-4.00','-4.25','-4.50','-4.75','-5.00','-5.25','-5.50','-5.75','-6.00','-6.25','-6.50','-6.75','-7.00','-7.25','-7.50','-7.75','-8.00','-8.25','-8.50','-8.75','-9.00','-9.25','-9.50','-9.75','-10.00','-10.25','-10.50','-10.75','-11.00','-11.25','-11.50','-11.75','-12.00','-12.25','-12.50','-12.75','99') ) ) and day(date_of_birth) <= day(now())
AND
month(date_of_birth) <= month(now())
AND
month(now()) - month(date_of_birth) <= 1 ORDER BY date_of_birth order by lead_id asc limit 50; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by lead_id asc limit 50' at line 5 at /usr/share/astguiclient/AST_VDhopper.pl line 1351.


i see, that there is already an order statement "order by lead_id asc limit 50"...
i want to remove the "order by lead_id", can i do that?
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Postby lerroux » Wed Aug 05, 2009 6:59 pm

i'd suggest you try it if it works. but back everything thing up so you dont f*** up your system

cheers,
lerroux
---------------------------------------------------
warning: excessive coding is dangerous to your health. if symptoms persist, insult your doctor.

System: VICIBOX - VICIDIAL 2.0.5
Asterisk version - 1.2.26.2
lerroux
 
Posts: 61
Joined: Thu Apr 23, 2009 11:36 am

Postby phil_discount » Thu Aug 06, 2009 12:25 am

in which file i have to remove the "order by lead_id"?
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Postby lerroux » Thu Aug 06, 2009 9:51 am

just guessing since you debugged this file:

/usr/share/astguiclient/AST_VDhopper.pl

still be careful though......
---------------------------------------------------
warning: excessive coding is dangerous to your health. if symptoms persist, insult your doctor.

System: VICIBOX - VICIDIAL 2.0.5
Asterisk version - 1.2.26.2
lerroux
 
Posts: 61
Joined: Thu Apr 23, 2009 11:36 am

Postby phil_discount » Fri Aug 07, 2009 2:28 am

thanks a lot,
i changed one order choice and removed the "order by lead_id asc"
it works fine!

Regards
Philip
phil_discount
 
Posts: 468
Joined: Thu Jun 18, 2009 8:44 am
Location: Deutschland/Schweiz/Österreich

Postby lerroux » Fri Aug 07, 2009 12:23 pm

no problem...
---------------------------------------------------
warning: excessive coding is dangerous to your health. if symptoms persist, insult your doctor.

System: VICIBOX - VICIDIAL 2.0.5
Asterisk version - 1.2.26.2
lerroux
 
Posts: 61
Joined: Thu Apr 23, 2009 11:36 am


Return to Support

Who is online

Users browsing this forum: No registered users and 86 guests