You are on page 1of 2

What is AMPscript?

AMPscript is a scripting language used by Exact Target. AMPscript is a server-side


scripting language

Tags used in AMPScript.


%%[  Starting Tag . It is equivalent to <script runat=server language=ampscript>
%%]  Closing tag . It is equivalent to </script>
Example %%[ LOWERCASE(Name) ]%%

%%[]%% -> it is equivalent to <script runat=server language=ampscript />


%%[[type=post;name=blockname] is equivalent to <script runat=server
language=ampscript executioncontexttype="Post" executioncontextname=blockname>

AMPScript is also used externally.

Constants:
1) String:- String must be quoted by single or double quotes.
2) Numeric:- Without any quotes and comma. Can be negative and also consist
decimal
3) Boolean:- Only true and false value.(Case sensitive)

Variables: Must consist VAR keyword followed by @ and at least one character
e.g VAR @name

Assign value to the variable: Use SET keyword


SET @name= ‘Rishi’

Condition Checking:
> Greater than
< Less than
== equal to
!= not equal to
<= less than equal to
>= greater than equal to
AND ,OR , NOT operator

If else Statement

e.g.
%%[ if @fname==rishi’ then ]%%
do something
else
do nothing
endif
Loop (For loop)

%%[ FOR @count=1 TO || DOWNTO 5 DO ]%%


%%=v(@count)=%%
%%[NEXT @count]%%
Note: TO is to increment the value and DOWNTO is to decrement the value.

Comment example
%%[ /* Insert Comment Here */ ]%
Keywords
Output() – echo the variable; OUTPUT(v(@fname))
OutputLine()

Function List
EMPTY – Check for blank value
Substring – SUBSTRING(‘Examle’,1,3) output will be Exa
Now() – Current date and time
s

Data Extensions
Subscriber->Data Extensionss

You might also like