Page 1 of 1

SQL query with a variable in a LIKE query

Posted: Wed Jul 11, 2007 11:44 am
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  
 

SQL query with a variable in a LIKE query

Posted: Thu Jul 12, 2007 7:38 am
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

SQL query with a variable in a LIKE query

Posted: Thu Jul 12, 2007 10:22 am
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

SQL query with a variable in a LIKE query

Posted: Thu Jul 12, 2007 10:46 am
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