Personalized email with loop dataset activity

I have a table that stores distribution list, first name, last name, email address, and I would like to create a loop activity that pulls in first name and email address for a specific list. So my query is as follows:

SELECT distribution_list, f_name, l_name, email
FROM dept_db.dbo.rpt_distribution_list
WHERE distribution_list = ‘Test’

I would like the email activity to send an email to each address on the list using a variable for email, and then include the first name in the body of the email using another variable. I think that I have to put the above query into the SQL Script section of the loop activity. I tried putting in a set variable and email activity within the Loop_row_1 section of the loop, but this didn’t work. Can anyone show me how to set up such a script?

what version of TDP are you using? There is a Set Variable and Set Variable Value, that work differently from each other in the higher versions of TPD. If you create the variable outside of the loop you must use Set Variable Value to update that value inside of the loop or it will create a new variable with the same name inside of the loop with a scope of just inside the loop. When you set your FirstName variable inside the loop set it to [tag:LoopResultName].F_Name#. Your loop query basically returns a table and then steps through it one row at a time.

Thanks Greg. I was able to get it to work.

Hi Toad World