Instantly share code, notes, and snippets.

Adam Spriggs wvpv

View GitHub Profile
View sfmc-sql-clear-data-extension.sql
select
null as Emailaddress
where 0 = 1
/* action: overwrite */
View sfmc-sql-ranking-method1.sql
select
x.bounceCategory
, x.sendid
from (
select
b.bounceCategory
, b.sendid
, row_number() over (partition by b.bounceCategory order by newid()) ranking
from _bounce b
) x
View sfmc-sql-ranking-method2.sql
select top 1 with ties
b.bounceCategory
, b.sendid
from _bounce b
order by row_number() over (partition by b.bounceCategory order by newid())
/* list all of the bounce categories and return */
/* a random sendid/jobid associated with each one */
View zip_xyz_axis_calc.sql
select
zip
, cos(radians(latitude)) * cos(radians(longitude)) xaxis
, cos(radians(latitude)) * sin(radians(longitude)) yaxis
, sin(radians(latitude)) zaxis
from zip_axis
/* credit https://stackoverflow.com/a/2233208/812377 */
View sfmc-ampscript-one-click-unsubscribe.html
%%[
var @debug
var @jid
var @listid
var @batchid
var @email
var @skey
var @reason
var @unsubscribeAll
View CNX18-ECAS-template.html
<div data-type="slot" data-key="init"></div>
<html>
<head>
<style>
body, a, input {font-family:sans-serif;}
</style>
<div data-type="slot" data-key="head"></div>
</head>
<body>
<div data-type="slot" data-key="body"></div>
View CNX18-ECAS-subscriberReferrals.amp
%%[
var @sk, @rows, @row, @rowCount, @i
set @sk = AttributeValue("_subscriberkey")
set @rows = LookupRows("SubscriberReferrals", "SubscriberKey", @sk)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
]%%
View CNX18-ECAS-init.amp
%%[
var @debug, @sk, @rows, @row, @rowCount
set @debug = 1
set @sk = AttributeValue("_subscriberkey")
set @rows = LookupRows("LoyaltyDemographics", "SubscriberKey", @sk)
set @rowCount = rowcount(@rows)
View CNX18-RASA-contact-delete.js
<script type="javascript" runat="server">
Platform.Load("core","1.1.5");
var DE = "Contacts_To_Delete";
var logDE = "Contacts_To_Delete_Log";
var log = DataExtension.Init(logDE);
var url = 'https://auth.exacttargetapis.com/v1/requestToken';
var contentType = 'application/json';
View CNX18-RASA-contact-delete-rest-api-postman.txt
POST /contacts/v1/contacts/actions/delete?type=listReference HTTP/1.1
Host: www.exacttargetapis.com
Content-Type: application/json
Authorization: Bearer ACCESS_TOKEN_GOES_HERE
Cache-Control: no-cache
{
"deleteOperationType": "ContactAndAttributes",
"targetList": {
"listType": {