高级表达式编辑器语法 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

以下是不同的区分大小写规则:

  • 所有运算符(and、or等) 应该写成小写。 例如,<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() not INAUDIENCE())
  • 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 but INAUDIENCE() 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 * 10 evaluate to 60 or 24? — It evaluates to 24 because * takes priority over +; use (4 + 2) * 10 to get 60.
  • Q: Can I write AND in uppercase in an expression? — No; all operators must be lowercase (and, or, not).
  • Q: Are function names case-sensitive? — Yes; inAudience() is valid but INAUDIENCE() 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