This topic is locked
[SOLVED]

 Use of additional query in MassMailer

1/16/2017 3:10:48 PM
PHPRunner General questions
W
WilliamB authorDevClub member

Hello,
I am trying to use the additional query section of the MassMailer v2 template. I cannot find any documentation on this template so will ask here.
I have an additional query set and use the "test" button and the preview shows that it works fine. I have the alias of the additional query set as thecount. How do I use this now in the "Execute SQL query after email sent" section? Also how do I call this in the email?
Thank you for helping in advance!
Billy

admin 1/16/2017

On official MassMailer template page ( http://xlinesoft.com/massmailer ) check section "How do I use 'Execute SQL query after email sent' field". In that code example we main.CustomerID to access CustomerID feild from the main query. You can use the same approach to access any field from your additional query.
And here is a more complete example for you:

http://xlinesoft.com/blog/2016/01/29/massmailer-template-use-case/

W
WilliamB authorDevClub member 1/16/2017



On official MassMailer template page ( http://xlinesoft.com/massmailer ) check section "How do I use 'Execute SQL query after email sent' field". In that code example we main.CustomerID to access CustomerID feild from the main query. You can use the same approach to access any field from your additional query.
And here is a more complete example for you:

http://xlinesoft.com/blog/2016/01/29/massmailer-template-use-case/


Thank you Sergey.
That does not seem to work for me. Maybe I am not understanding something.
My additional query is:

select count(ID) as num from tTrans where ClientID='%main.ClientID%' and CancelCode='N/A' and TransDate>='%main.StartDate%'



I have made the alias for this "sub"
So I am using %sub.num% to pull this value and it will not work.

admin 1/17/2017

It looks like it should work. It's hard to tell though without seeing database structure and the rest of setup.
If you have a a valid support contract post your project to Demo Account and contact support directly at http://xlinesoft.com/dss/support.asp