進階運算式編輯器語法 syntax
以下列出使用進階運算式編輯器時的語法基本知識。
括弧和運算式優先順序 parentheses-and-expression-priority
括弧可用來讓複雜的運算式更容易閱讀。 (<運算式>)相當於<運算式>。 括弧也可用來定義評估順序和關聯性。
運算式將由左至右評估。 必須套用算術運運算元的關聯性:乘法和除法優先於加法和減法。 為了強制特定順序,必須加入括弧以分隔操作。 例如:
運算式
評估
4 + 2 * 10- ‘*‘優先順序高於’+’:2 * 10→20計算
- 4 + 20 → 24
(4 + 2) * 10- 括弧會變更優先順序: (4 + 2)的評估方式→6
- 6 * 10 → 60
區分大小寫 case-sensitivity
以下是不同的區分大小寫規則:
- 所有運運算元(和、或等) 應該寫成小寫。 例如,
<expression1>和<expression2>是有效的運算式,而運算式<expression1>AND<expression2>則否。 - 所有函式名稱都區分大小寫。 例如,inAudience()有效,而函式 INAUDIENCE() 無效。
- 欄位參照和常數值區分大小寫:它們不是語言的內建元素(與運運算元和函式相反),而是由一般使用者撰寫。
傳回的運算式型別 returned-expression-type
根據使用內容,運算式編輯器可傳回不同的值。
進階運算式編輯器使用
預期傳回的運算式型別
條件(資料來源條件、日期條件)
布林值
自訂計時器
dateTimeOnly
動作引數對應
任何
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 covers the core syntax rules of the Journey advanced expression editor — operator precedence with parentheses, case sensitivity for operators and functions, and the expected return type for each editor context.
Intents:
- Control expression evaluation order by wrapping sub-expressions in parentheses
- Write operators (
and,or,not) in lowercase to avoid syntax errors - Use correctly cased function names (e.g.
inAudience()notINAUDIENCE()) - Understand that conditions must return a boolean, custom timers must return
dateTimeOnly, and action parameter mappings can return any type
Glossary:
- Expression priority: The order in which operators are evaluated; multiplications and divisions take priority over additions and subtractions (product-specific)
- Case sensitivity: In the advanced editor, operators must be lowercase, function names are case-sensitive, and field references are case-sensitive as authored by the user (product-specific)
- dateTimeOnly: The return type required for custom timer (Wait activity) expressions; represents a date-time without a timezone (product-specific)
Guardrails:
- Operators (
and,or,not, etc.) must be written in lowercase — uppercase variants are invalid - All function names are case-sensitive —
inAudience()is valid butINAUDIENCE()is not - Arithmetic follows standard precedence:
*and/evaluate before+and-; use parentheses to override - Conditions always return a boolean; custom timers always return
dateTimeOnly
Terminology:
- Canonical name: Advanced Expression Editor Syntax — Acronym: none — variants: expression syntax, editor syntax
- Synonyms: “expression priority” = “operator precedence”; “parentheses” = “brackets” (in expression context)
- Do not confuse: operator case sensitivity (operators must be lowercase) ≠ field reference case sensitivity (field names are user-authored and case-sensitive as written)
FAQ:
- Q: Does
4 + 2 * 10evaluate to 60 or 24? — It evaluates to 24 because*takes priority over+; use(4 + 2) * 10to get 60. - Q: Can I write
ANDin uppercase in an expression? — No; all operators must be lowercase (and,or,not). - Q: Are function names case-sensitive? — Yes;
inAudience()is valid butINAUDIENCE()is not. - Q: What type must a condition expression return? — A boolean.
- Q: What return type is required for a custom Wait activity timer expression? —
dateTimeOnly.
recommendation-more-help
journey-optimizer-help