Skip to main content

AMPscript Templates from Advanced Marketer Bootcamp 

Hope this saves MCE Trailblazers some time! Copied from the Code Snippets used in our Email builds during class.

 

AMPscript IF Function

 

%%[IF @VariableName == VariableValue THEN

]%%

Thank you for being a member of myNTO.

 

%%[ELSE]%%

Join myNTO today to start earning rewards!

 

%%[ENDIF]%%

 

AMPscript Lookup Function

 

SET @VariableName = LookUp("LookupDE", "ReturnField", "QueryField", @QueryValue)

 

AMPscript Update DE

 

%%[

 

/* Lookup the values for the subscriber */

 

    VAR @SubscriberKey, @EmailAddress

    SET @SubscriberKey = _subscriberkey

    SET @EmailAddress = emailaddr

 

/* Update the Data Extension */

 

    IF Not Empty(@SubscriberKey) THEN

        UpsertData("Update_DE_Name", 1, "UpdateField1", @UpdateField1_Value, "UpdateField2", UpdateField2_Value)

    ENDIF

]%%

 

AMPscript for loop

 

%%[

SET @rows = LookupRows("LookupDE","QueryField",@QueryValue)

SET @rowCount = RowCount(@rows)

 

FOR @counter = 1 to @rowCount DO

  SET @row = row(@rows,@counter)

  SET @VariableName = field(@row,"ReturnField") ]%%

 

  %%=v(@VariableName)=%%<br>

 

%%[ next ]%%

0/9000