View sfmc-sql-geo-distance.sql
SELECT
x.emailAddress
, x.firstName
, x.zip
, x.store_zip
, x.store_phone
, x.ranking
, x.distance /* added 2014-11-13 */
from (
SELECT
View sfmc-dedupe-external-rows.html
%%[
var @i, @rows, @row, @productName, @prevProductName, @rowsToReturn
var @rowsToReturn = 0 /* up to 2000 */
SET @rows = LookupOrderedRows("SubscriberProducts" ,@rowsToReturn, "ProductName asc", "EmailAddress",emailaddr)
set @prevProductName = ""
FOR @i = 1 TO RowCount(@rows) DO
View sfmc-number-suffixes.html
%%[
var @day, @suffix
for @day = 1 to 31 do
/* set @day = Format(Now(),"dd")) */
/* adapted from http://stackoverflow.com/a/13627586/812377 */
if mod(@day,10) == 1 and mod(@day,100) != 11 then
View sfmc-lowest-of-three-numbers.html
%%[
var @num1, @num2, @num3, @lowestNum
/* force strings to be numbers */
set @num1 = add('105.54',0)
set @num2 = add('88.73',0)
set @num3 = add('106.32',0)
/* find lowest with method outlined here: http://stackoverflow.com/a/9424226/812377 */
set @lowestNum = iif(@num1 < iif(@num2 < @num3, @num2, @num3), @num1, iif(@num2 < @num3, @num2, @num3))
View SFMC-prettying-up-ampscript.html
%%[/* Modify to view AMPScript <div style="display:none"> */
/* your big blob of AMPScript goes here */
/*</div>*/
]%%
View bash-convert-mkv-to-mp4-with-avconv.sh
find ./ -name '*.mkv' -exec bash -c 'avconv -i "$1" -c:v copy -c:a copy "${1%.mkv}.mp4"' _ {} \;
View SFMC-SSJS-delete-rows-from-DE.js
<script runat="server">
Platform.Load("core", "1.1.1");
function pruneRows () {
var DERowKeys = DataExtension.Init("DEofRowKeys");
var DERowKeyRows = DERowKeys.Rows.Lookup(["ProcessedFlag"], [0], 50, "RowDate");
var returnString = "";
View SFMC-SSJS-retrieve-start-automation.js
<script runat="server">
Platform.Load("Core","1.1.1");
var automationCustomerKey = "CUSTOMERKEY-OF-AUTOMATION"
var rr = Platform.Function.CreateObject("RetrieveRequest");
Platform.Function.SetObjectProperty(rr, "ObjectType", "Automation");
Platform.Function.AddObjectArrayItem(rr, "Properties", "ProgramID");
Platform.Function.AddObjectArrayItem(rr, "Properties", "CustomerKey");
View SFMC-AMPScript-Coupon-Claiming
%%[
var @em, @couponRow, @couponCode, @rows, @row
/* include your sendable attribute/column here */
set @em = AttributeValue("emailAddr")
set @rows = LookupRows("couponCodes","EmailAddress",@em)
if rowcount(@rows) > 0 then
View SFMC-AMPScript-Upsert-Data-Extension-Row.amp
%%[
var @firstName, @lastName
set @firstName = "Scut"
set @lastName = "Farcus"
UpsertDE("My_Test_DataExtension",1,"SubscriberKey",_SubscriberKey,"FirstName",@firstName,"LastName",@lastName)
]%%