式の編集 edit-expressions

このページ:​式エディターを使用して、オーケストレーションキャンペーンで日付、文字列、数値を操作するためのデータベースフィールド、変数、ヘルパー関数を使用してルールを手動で作成する方法について説明します。

NOTE
以下の節では、式エディターを操作してルールを作成する方法について説明します。 ルールの作成に使用する構文は、パーソナライゼーションの追加に使用する構文とは異なることに注意してください。

式エディターの操作 edit

式を編集する場合は、条件を手動で入力してルールを作成します。 このモードでは、日付、文字列、数値の各フィールドの操作や並べ替えなど、具体的なクエリの実行に使用する値を操作する高度な関数を使用できます。

式エディターは、ルールビルダーの「式を編集」ボタンから実行できます。このボタンは、カスタム条件を設定する際に「属性」フィールドと「値」フィールドで使用できます。

「属性」フィールドからのアクセス
「値」フィールドからのアクセス
属性フィールドの式エディター {align="center" width="200" modal="regular"}
値フィールドの式エディター {align="center" width="200" modal="regular"}

式エディターには、次の内容があります。

  • 式を定義する​入力フィールド(1)。

  • 式で使用でき、かつクエリのターゲティングディメンションに対応する​ フィールド(2) ​の一覧。

  • 式で使用できる​ 変数(3) ​の一覧。 このメニューは、「値」フィールドで使用できます。 オーケストレーションキャンペーンでの変数の使用方法の詳細情報

  • カテゴリ別に並べ替えられる​ヘルパー関数(4)。

式を編集するには、入力フィールドに式を直接入力します。 フィールド、変数またはヘルパー関数を追加するには、式内の追加する場所にカーソルを置き、「+」ボタンをクリックします。

式エディターのインターフェイス {modal="regular"}

ヘルパー関数

クエリ編集ツールを使用すると、高度な関数を使用して、目的の結果や操作対象のデータのタイプに応じて複雑なフィルタリングを実行できます。 次の関数を使用できます。

集計

集計関数は、一連の値に対して計算を実行します。

名前
説明
構文
Avg
数値タイプの列の平均を返します
Avg(<値>)
カウント
列の null でない値をカウントします
Count(<値>)
CountAll
返される値をカウントします(すべてのフィールド)
CountAll()
Countdistinct
列の null でないユニーク値をカウントします
Countdistinct(<値>)
Max
数値、文字列または日付タイプの列の最大値を返します
Max(<値>)
Min
数値、文字列または日付タイプの列の最小値を返します
Min(<値>)
StdDev
数値、文字列または日付タイプの列の標準偏差を返します
StdDev(<値>)
StringAgg
文字列タイプの列の値を、2 番目の引数の文字で区切って連結した結果を返します
StringAgg(<値>, <文字列>)
合計
数値、文字列または日付タイプの列の値の合計を返します
Sum(<値>)

日付

日付関数は、日付や時刻の値を操作します。

名前
説明
構文
AddDays
日付に日数を追加します
AddDays(<日付>, <数値>)
AddHours
日付に時間数を追加します
AddHours(<日付>, <数値>)
AddMinutes
日付に分数を追加します
AddMinutes(<日付>, <数値>)
AddMonths
日付に月数を追加します
AddMonths(<日付>, <数値>)
AddSeconds
日付に秒数を追加します
AddSeconds(<日付>, <数値>)
AddYears
日付に年数を追加します
AddYears(<日付>, <数値>)
ConvertNTZ
定義されたセッション TZ を適用して、タイムスタンプ NTZ(タイムゾーンなしのタイムスタンプ)を TZ(タイムゾーンありのタイムスタンプ)に変換します
ConvertNTZ (<日付+時間>)
DateCmp
2 つの日付を比較します
DateCmp(<日付>,<日付>)
DateOnly
日付のみを返します(時刻は 0:00)
DateOnly(<日付>)
Day
日付の日を表す数を返します
Day(<日付>)
DayOfYear
日付の年内通算日を返します
DayOfYear(<日付>)
DaysAgo
現在の日付 - n 日に対応する日付を返します
DaysAgo(<数値>)
DaysAgoInt
現在の日付 - n 日に対応する日付(整数 yyyymmdd)を返します
DaysAgoInt(<数値>)
DaysDiff
2 つの日付の間の日数を返します
DaysDiff(<終了日>, <開始日>)
DaysOld
日付の経過日数を返します
DaysOld(<日付>)
GetDate
サーバーの現在のシステム日付を返します
GetDate()
Hour
日付の時を返します
Hour(<日付>)
HoursDiff
2 つの日付の間の時間数を返します
HoursDiff(<終了日>, <開始日>)
Minute
日付の分を返します
Minute(<日付>)
MinutesDiff
2 つの日付の間の分数を返します
MinutesDiff(<終了日>, <開始日>)
月
日付の月を表す数を返します
Month(<日付>)
MonthsAgo
現在の日付 - n ヶ月に対応する日付を返します
MonthsAgo(<数値>)
MonthsDiff
2 つの日付の間の月数を返します
MonthsDiff(<終了日>, <開始日>)
MonthsOld
日付の経過月数を返します
MonthsOld(<日付>)
Oldest
範囲内の最も古い日付を返します
Oldest (<日付, 日付>)
Second
日付の秒を返します
Second(<日付>)
SecondsDiff
2 つの日付の間の秒数を返します
SecondsDiff(<終了日>, <開始日>)
SubDays
日付から日数を引きます
SubDays(<日付>, <数値>)
SubHours
日付から時間数を引きます
SubHours(<日付>, <数値>)
SubMinutes
日付から分数分を引きます
SubMinutes(<日付>, <数値>)
SubMonths
日付から月数を引きます
SubMonths(<日付>, <数値>)
SubSeconds
日付から秒数を引きます
SubSeconds(<日付>, <数値>)
SubYears
日付から年数を引きます
SubYears(<日付>, <数値>)
ToDate
日付 + 時間を日付に変換します
ToDate(<日付 + 時刻>)
ToDateTime
文字列を日付 + 時刻に変換します
ToDateTime(<文字列>)
ToTimestamp
文字列をタイムスタンプに変換します
ToTimestamp(<文字列>)
ToTimeZone
日時を別のタイムゾーンに変換します
ToTimeZone(<日付>, <タイムゾーン>)
TruncDate
日付 + 時刻を最も近い秒に四捨五入します
TruncDate(@lastModified, <秒数>)
TruncDateTZ
日付 + 時刻を指定された精度(秒)に四捨五入します
TruncDateTZ(<日付>, <秒数>, <タイムゾーン>)
TruncQuarter
日付を四半期に四捨五入します
TruncQuarter(<日付>)
TruncTime
時刻部分を最も近い秒に四捨五入します
TruncTime(<日付>, <秒数>)
TruncWeek
日付を週に四捨五入します
TruncWeek(<日付>)
TruncYear
日付 + 時刻をその年の 1月1日に四捨五入します
TruncYear(<日付>)
WeekDay
日付の曜日を表す数値を返します(0=月曜日、6=日曜日)
WeekDay(<日付>)
Year
日付の年を表す数を返します
Year(<日付>)
YearAndMonth
日付の年と月を表す数を返します
YearAndMonth(<日付>)
YearsAgo
指定された日付と現在の日付の間の年数を返します
YearsAgo(<日付>)
YearsDiff
2 つの日付の間の年数を返します
YearsDiff(<終了日>, <開始日>)
YearsOld
満年齢を返します
YearsOld(<日付>)
NOTE
DateOnly 関数はオペレーターのタイムゾーンではなく、サーバーのタイムゾーンを考慮することに注意してください。

ジオマーケティング

ジオマーケティング関数は、地理に関する値を操作する場合に使用します。

名前
説明
構文
Distance
経度と緯度で定義された 2 つのポイントの距離を返します。
Distance(<経度 A>, <緯度 A>, <経度 B>, <緯度 B>)

数値

数値関数は、テキストを数値に変換する場合に使用します。

名前
説明
構文
Abs
数値の絶対値を返します
Abs(<数値>)
Ceil
ある特定の数値以上の最小の整数を返します
Ceil(<数値>)
Floor
ある特定の数値以上の最大の整数を返します
Floor(<数値>)
Greatest
2 つの数のうち大きい方を返します
Greatest(<数値 1>, <数値 2>)
Least
2 つの数のうち小さい方を返します
Least(<数値 1>, <数値 2>)
Mod
整数の割り算 n1 ÷ n2 の余りを返します
Mod(<数値 1>, <数値 2>)
Percent
割合で表される 2 つの数の比率を返します
Percent(<数値 1>, <数値 2>)
Random
ランダムな値を返します
Random()
Round
数値を n 桁に丸めます
Round(<数値>, <小数点以下の桁数>)
Sign
数値の符号を返します
Sign(<数値>)
ToDouble
整数を浮動小数に変換します
ToDouble(<数値>)
ToInt64
浮動小数を 64 ビットの整数に変換します
ToInt64(<数値>)
ToInteger
浮動小数を整数に変換します
ToInteger(<数値>)
Trunc
n1 を n2 の桁数に切り捨てます
Trunc(<n1>, <n2>)

その他

以下の表には、上記以外の使用可能な関数が記載されています。

名前
説明
構文
AESEncrypt
引数で指定された文字列を暗号化
AESEncrypt(<value>)
Case
条件が true の場合は値 1 を返します。 そうでない場合は値 2 を返します
(When(<条件>, <値 1>), Else(<値 2>))
ClearBit
値のフラグを削除します
ClearBit(<識別子>, <フラグ>)
Coalesce
値 1 がゼロまたは null の場合は値 2 を返し、それ以外の場合は値 1 を返します
Coalesce(<値 1>, <値 2>)
Decode
値 1 = 値 2 の場合は値 3 を返します。 そうでない場合は値 4 を返します
Decode(<値 1>, <値 2>, <値 3>, <値 4>)
Else
値 1 を返します(case 関数のパラメーターとしてのみ使用できます)
Else(<値 1>, <値 2>)
GetEmailDomain
メールアドレスからドメインを抽出します
GetEmailDomain(<値>)
GetMirrorURL
ミラーページサーバーの URL を取得します
GetMirrorURL(<値>)
Iif
式が true の場合は値 1 を返します。 そうでない場合は値 2 を返します
Iif(<条件>, <値 1>, <値 2>)
IsBitSet
値にフラグが含まれているかどうかを示します
IsBitSet(<識別子>, <フラグ>)
IsEmptyString
文字列 1 が空の場合は値 2 を返し、それ以外の場合は値 3 を返します
IsEmptyString(<値 1>, <値 2>, <値 3>)
NewUUID
一意の ID を返します
NewUUID()
NoNull
引数が NULL の場合は、空の文字列を返します
NoNull(<値>)
RowId
ライン番号を返します
RowId
SetBit
値に強制的にフラグを指定します
SetBit(<識別子>, <フラグ>)
ToBoolean
数値をブール値に変換します
ToBoolean(<数値>)
When
式が true の場合は値 1 を返します。 そうでない場合は値 2 を返します(case 関数のパラメーターとしてのみ使用できます)
When(<条件>, <値 1>)

文字列

文字列関数は、一連の文字列を操作する場合に使用します。

名前
説明
構文
AllNonNull2
すべてのパラメーターが null でなく空でもないかどうかを示します
AllNonNull2(<文字列>, <文字列>)
AllNonNull3
すべてのパラメーターが null でなく空でもないかどうかを示します
AllNonNull3(<文字列>, <文字列>, <文字列>)
Ascii
文字列の最初の文字の ASCII 値を返します
Ascii(<文字列>)
Char
ASCII コード「n」に対応する文字を返します
Char(<数値>)
Charindex
文字列 1 における文字列 2 の位置を返します
Charindex(<文字列>, <文字列>)
dataLength
文字列のサイズをバイト単位で返します
dataLength(<文字列>)
GetLine
文字列の n 番目(1 から n)のラインを返します
GetLine(<文字列>)
IfEquals
最初の 2 つのパラメーターが等しい場合に、3 番目のパラメーターを返します。 等しくない場合は、最後のパラメーターを返します
IfEquals(<文字列>, <文字列>, <文字列>, <文字列>)
IsMemoNull
パラメーターとして渡されたメモが null かどうかを示します
IsMemoNull(<メモ>)
JuxtWords
パラメーターとして渡された文字列を連結します。 必要に応じて、文字列間にスペースを追加します.
JuxtWords(<文字列>, <文字列>)
JuxtWords3
パラメーターとして渡された文字列を連結します。 必要に応じて、文字列間にスペースを追加します
JuxtWords3(<文字列>, <文字列>, <文字列>)
Left
文字列の最初の n 文字を返します
Left(<文字列>, <数値>)
Length
文字列の長さを返します
Length(<文字列>)
Line
文字列から n 行目を抽出
Line(<string>,<number>)
Lower
文字列を小文字で返します
Lower(<文字列>)
LPad
左側の完成した文字列を返します
LPad (<文字列>, <数値>, <文字数>)
Ltrim
文字列の左側の空白を削除します
Ltrim(<文字列>)
Md5Digest
文字列の MD5 キーの 16 進数表現を返します
Md5Digest(<文字列>)
MemoContains
パラメーターとして渡す文字列をメモに含めるかどうかを指定します
MemoContains(<メモ>、<文字列>)
NodeValue
XPath とフィールドデータから XML フィールドの値を抽出します
NodeValue (<文字列>, <文字列>)
Replace
指定された文字列値のすべての発生を別の文字列値に置き換えます。
Replace(<String>,<String>,<String>)
Right
文字列の最後の n 文字を返します
Right(<文字列>)
RPad
右側の完成した文字列を返します
RPad(<文字列>, <数値>, <文字>)
Rtrim
文字列の右側の空白を削除します
Rtrim(<文字列>)
Sha256Digest
文字列の SHA256 キーの 16 進数表現。
Sha256Digest (<文字列>)
Sha512Digest
文字列の SHA512 キーの 16 進数表現。
Sha512Digest (<文字列>)
Smart
各単語の最初の文字を大文字にして文字列を返します
Smart(<文字列>)
Substring
文字列の n1 文字目から始まる長さ n2 文字の部分文字列を抽出します
Substring(<文字列>, <オフセット>, <長さ>)
ToString
数値を文字列に変換します
ToString(<数値>, <数値>)
Upper
文字列を大文字で返します
Upper(<文字列>)
VirtualLink
他の 2 つのパラメーターが等しい場合に、パラメーターとして渡されたリンクの外部キーを返します
VirtualLink(<数値>, <数値>, <数値>)
VirtualLinkStr
他の 2 つのパラメーターが等しい場合に、パラメーターとして渡されたリンクの外部(テキスト)キーを返します
VirtualLinkStr(<文字列>, <数値>, <数値>)

ウィンドウ

名前
説明
構文
_Over__
第 1 パラメーターとして入力された SQL 関数呼び出しを、第 2 パラメーターとして入力された「パーティション」または「並べ替え順」フィールドより優先して実行します
_Over_(<値>, <値>)
Desc
降順ソートを適用します
Desc(<値 1>)
OrderBy
パーティション内の結果を並べ替えます
OrderBy(<値 1>)
PartitionBy
テーブルのクエリの結果を区分します
PartitionBy(<値 1>)
RowNum
テーブルのパーティションと並べ替えシーケンスに基づいてライン番号を生成します
RowNum(PartitionBy(<値 1>), OrderBy(<値 1>))
AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: This page explains how to use the expression editor to manually build rule conditions with fields, variables, and helper functions for manipulating dates, strings, numbers, and other values in Orchestrated campaigns.

Intents:

  • Open the expression editor from the Attribute or Value field when configuring a custom condition in the rule builder.
  • Enter an expression directly in the input field, or insert a field, variable, or helper function using the + button.
  • Use helper functions (Aggregate, Date, Geomarketing, Numeric, Others, String, Window) to manipulate dates, strings, numeric values, and sorting.
  • Insert variables into an expression from the Value field.

Glossary:

  • Expression editor: a mode accessed from the rule builder Edit expression button that lets you manually enter conditions to form a rule, using advanced functions (product-specific)
  • Helper functions: functions sorted by category (Aggregate, Date, Geomarketing, Numeric, Others, String, Window) available in the expression editor to manipulate values (product-specific)
  • Fields: items available in the expression editor that correspond to the targeting dimension of the query (product-specific)
  • Variables: items available in the expression editor, from the Value field menu, that can be used in an expression (product-specific)

Guardrails:

  • The expression editor is available from the rule builder Edit expression button, for the Attribute and Value fields, when configuring a custom condition.
  • The variables menu in the expression editor is available only for the Value field, not for the Attribute field.
  • The DateOnly function takes into account the server’s timezone, not the operator’s.

Terminology:

  • Canonical name: expression editor — variants: Edit expression
  • Do not confuse: “fields” (correspond to the targeting dimension of the query) ≠ “variables” (listed in a separate menu, available from the Value field)

FAQ:

  • Q: Where is the expression editor available from? — The rule builder Edit expression button, for the Attribute and Value fields, when configuring a custom condition.
  • Q: How do I add a field, variable, or helper function to an expression? — Place your cursor in the expression where you want to add it and click the + button.
  • Q: What categories of helper functions are available? — Aggregate, Date, Geomarketing, Numeric, Others, String, and Window.
  • Q: Does the DateOnly function use my local timezone? — No, it takes into account the server’s timezone, not the operator’s.
  • Q: Can I use variables from the Attribute field? — No, the variables menu is available only for the Value field.

Related pages:

  • For using variables in an expression from the Value field: Learn how to use variables in Orchestrated campaigns (orchestrated/variables-orchestrated-campaigns.md)

Personas:

  • marketer: Can open the expression editor from the Attribute or Value field when configuring a custom condition, and enter an expression directly in the input field. Can place the cursor and select the + button to add a field, variable, or helper function. Can use helper functions sorted by category, such as Aggregate, Date, Geomarketing, Numeric, Others, String, and Window, to manipulate dates, strings, numeric values, and sorting. The page states that the variables menu is available only for the Value field. Where: “Work with the expression editor”.

Onboarding:

  • Level: Experienced
  • First minimal step: Select the Edit expression button for the Attribute or Value field when configuring a custom condition.
  • Next: Learn how to use variables in the expression editor: Use variables in Orchestrated campaigns (orchestrated/variables-orchestrated-campaigns.md)
recommendation-more-help
journey-optimizer-help