AMPscript では IF/ELSE ステートメントにネイティブの「contains」機能がありませんが、IndexOf() 関数を使用することで特定の値が含まれているかを判定できます。例えば、文字列が「Indianapolis」を含む場合に特定のメッセージを返す方法を解説します。AMPscript 構文ガイドや IndexOf() 関数の詳細も参照してください。
%%[
Var @String, @Value, @Output
/* Set the value to check */
Set @Value= "Indianapolis"
/* Set the string to check */
Set @String = "Welcome to Indianapolis, we hope you enjoy your stay!"
/* Does it match; ; if no match, output of IndexOf(1,2) will be "0" */
if IndexOf(@String,@Value) > 0 then
Set @Output = "How was your stay in Indianapolis"
else
Set @Output = "Where would you like to stay?"
endif
]%%
<!-- Within the body of your email, you can print out the variable here -->
%%=v(@Output)=%%
000386572

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.