<aside> <img src="/icons/directional-sign-right_blue.svg" alt="/icons/directional-sign-right_blue.svg" width="40px" /> 本页面是基于 Notion 这个官方文档 制作的中英双语版本。


Property/属性

Formulas support many property types. For those that aren't supported directly, data is automatically converted into another data type (usually text). 公式支持许多属性类型。对于那些不直接支持的数据,数据会自动转换为另一种数据类型 (通常是文本)。

Property Types/属性类型 Examples/示例 Formula Type/公式结果格式
Title/标题 prop("Title")
prop("Title").length() Text/文本
(即字符串,下同)
Text/文本 prop("Text")
prop("Text").length() Text
Select/单选 prop("Priority") == "High" Text
Multi-Select/多选 prop("Tags").length()
prop("Tags").includes("Finance") Text
Checkbox/复选框 prop("Checkbox")not prop("Checkbox") Boolean/布尔值
(即是/否,旧称字符串/String)
Email, URL, Phone Number/邮箱、连接、手机号码 !empty(prop("Phone"))!empty(prop("Email"))link("Call", "tel:" + prop("Phone")) Text
Unique ID/唯一 ID prop("Task ID").split("-").first() ← Prefix/前缀
prop("Task ID").split("-").last() ← ID/唯一识别码 Text
Created By,Edited By/创建者、编辑者 prop("Created By").name()prop("Created By").email() People/人员
People/成员 prop("Person")prop("Person").at(0).name()prop("Person").map(current.email()) People/人员
Date,Created Time,Last Edited Time/日期、创建时间、上次编辑时间 prop("Due Date") > now()dateBetween(prop("Birthday"), now(), "days") Date/日期
Number/数字 prop("Number") / 2pi() * prop("Radius") ^ 2 Number/数字
Relation/关联 prop("Tasks").length()prop("Tasks").filter(current.prop("Status") !== "Done") Page/页面
Rollup/指向 prop("Purchases").length()prop("Average cost") * 12 Number, date, or list of any type. Depends on rollup configuration./数字、日期或者任何类型的列表,取决于 Rollup 的具体配置

Built-ins/内置操作符和值

Built-ins are specific symbols and values that are built into the language to help designate a calculation. 内置的是特定的符号和值,这些符号和值内置到语言中以帮助指定计算。

Built-in/内置符号和值 Example/示例
Math operators/数学运算:
+-*% 2 * pi()
"hello" + "world"
Boolean values/布尔值:
truefalse true
false
Comparison operators/比较运算:
==>>=<<= 123 == 123 = true
"Notion" == "Motion" = false
Logical operators/逻辑运算:
andornot and
`true and false
true && false
and(true, false)`
or
`true or false
true
or(true, false)`
not
`not true
!true`
Ternary operator/三元运算:
? : X ? Y : Z is equivalent to if(X, Y, Z)

Functions/函数

Notion formulas support the following functions. Notion 公式支持以下函数。

Formulas 2.0 Table