forked from HowToSFMC/AMPscript_materials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AMPscriptBasics_initBlock.html
66 lines (36 loc) · 1.11 KB
/
AMPscriptBasics_initBlock.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
%%[ /* AMPscript Init Block */
SET @debug = 1
/* set items needed for your template to function first */
SET @email = [subscriberKey]
IF Empty(@email) THEN
SET @email = AttributeValue(emailaddr)
ENDIF
SET @Preheader = 'preheader text'
SET @subjectLine = 'subject line'
/* bring in data specific to the email or campaign next */
SET @subData = LookupRows('subscriberData','subscriberKey',@email)
SET @subRowCount = RowCount(@subData)
IF @subRowCount > 0 THEN
SET @subDataRow = Row(@subData,1)
SET @rewardTier1 = Field(@subDataRow,'rewardTier1')
SET @rewardTier2 = Field(@subDataRow,'rewardTier2')
IF Empty(@rewardTier1) THEN
SET @displayPrompt1 = 'empty'
ELSEIF @rewardTier1 <= 9 THEN
SET @displayPrompt1 = 'remainder'
ELSE
SET @displayPrompt1 = 'coupon'
SET @tier = 'rewardTier1'
ENDIF
IF Empty(@rewardTier2) THEN
SET @displayPrompt2 = 'empty'
ELSEIF @rewardTier2 <= 9 THEN
SET @displayPrompt2 = 'remainder'
ELSE
SET @displayPrompt2 = 'coupon'
SET @tier = 'rewardTier2'
ENDIF
ELSE
RaiseError(Concat('no data found for ', @email),'true')
ENDIF
]%%