SQL query with a variable in a LIKE query

Discuss RoboTask here
Post Reply
lorenzob
Posts: 21
Joined: Wed Jul 11, 2007 11:30 am

SQL query with a variable in a LIKE query

Post by lorenzob »

Hi,
I am testing your product and I have to say it is very well done. I have a problem with a query in a like statement:

select numberofpage from accounts where email LIKE
'%{SENDER}%';

The sender variable is the one defined in the PO3mail loop.
As you state in your guide:
Note:
Addresses in the message can be written in form of:

·
E-mail address only. For example:
john@yahoo.com

·
Recipient's name and address. For example:
John Smith <john@yahoo.com>

·
Several recipients separated with a semicolon. For example:
John Smith <john@yahoo.com>; Melissa Carver melissa@hotmail.com
I have the problem that the incoming mails sometimes are set as
John Smith <john@yahoo.com> and in my db the data for the email is john@yahoo.com. I thought that by using the wildcards this will be solved but it doesn't. Do you have a solution for this?
Thanks
Lorenzo  
 
lorenzob
Posts: 21
Joined: Wed Jul 11, 2007 11:30 am

SQL query with a variable in a LIKE query

Post by lorenzob »

FOUND the solution. Was not possible via SQL.I did it via Basic script and I write it here in case it is useful for someone else:Sub Main   Dim delimit, result As String   Dim p0,p1 As Integer   delimit = RoboTaskApp.ExpandText("{sender}")   p0 = InStr(delimit,"<")   p1 = InStr(delimit,">")   If p0<>0 And p1 <>0 Then      result = Mid(delimit,p0+1,p1-p0-1)      RoboTaskApp.SetUserVariable ("email",result)   Else      RoboTaskApp.SetUserVariable ("email","none")   End IfEnd Sub
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

SQL query with a variable in a LIKE query

Post by Oleg »

Yes of course.
I wanted to advise you something similar, but you have passed ahead .

Probably we'll add function of extraction email address only from SENDER or TO fields. I wrote this into our ToDo list
lorenzob
Posts: 21
Joined: Wed Jul 11, 2007 11:30 am

SQL query with a variable in a LIKE query

Post by lorenzob »

Would be great. I would also add a more general feature to work on strings for comparison and other. This feature is available in similar products. But in many aspects yours is better. I think I will defenitely buy it.ThanksLorenzo
Post Reply