Question

Photo of Justin Van Vuuren

0

Email/email template with SQL content

Hi there,

Blessings and seasons greetings to all!

I'm currently work on email templates for much Church.

I would like to populate an email with all members that have a birthday in the week based on the current date.

I know how to right SQL queries but I have no clue on how to get the results into an email (and/or email template).

How does one do it? and what is the best solution?

Regards,

Justin

  • Photo of Brian Davis

    0

    I am a bit of a newbie to Rock but I am working on a similar project at the moment so I thought I would share what I had learned, this far.

    I was not able to add the results of an SQL query into an email by using the SQL Lava Command, my guess is that is due to the security restrictions related to running an SQL query.  My workaround was to create a Lava Short Code that ran the SQL lava command and outputs the results of query. I then inputted the Short Code into the email body. There may be a more elegant way to do this, but this is the best method that I have found thus far.


    Please let me know if there is any other detail that I can provide.

  • Photo of Nick Airdo

    0

    One way to get a list of people who are having a birthday in the next 7 days would be to build a data view (of your active adults) and then use the Days Until Birthday filter like so:

    DaysUntilBirthday2.png

    Once you've got that saved, you can just use the communicate button on the data view results to go to your communication template:

    DaysUntilBirthday-step2.png


    If you have special SQL that you're really interested in using, then I would use the DynamicData block with your SQL and check the Communicate button in the Show Grid Actions setting:

    DaysUntilBirthday-DynamicData.png

  • Photo of Brian Davis

    0

    Sorry, after reading Nick's awesome post I realized that my earlier post may have been off-topic and confusing.  My response was related to creating an automated email message that includes a list of members and their recent birthdays in its message body.

    Nick's response, which I am guessing is better applicable to your situation, is related to sending an email to a list of members that had a recent birthday.

  • Photo of Eugene Marais

    0

    I suspect that you have both hit the sweet spot for us! Thanks Nick and Brian!