Validate results(验证结果(Validate results))¶
Fusion offers a set of validation formulas. They display as buttons, which are triggered upon click. If the validation fails, an error explaining why is displayed.
The validation functions are best used inside serial Actions with the use of toast Actions to display success and failure messages. See the Actions documentation for more details.
This page is an overview of available validation formulas. For a full list of formulas and arguments, see the function library.
Enumerate¶
The column_enum(...) validation checks the entries in a column are all within a specific list of values. The listed values can be entered into the formula manually (e.g. array('red', 'blue', 'green')) or through a reference (e.g. array_flatten(B3:B14))

Not null¶
The column_not_null(...) validation checks a column has no null values.

Numeric¶
The column_numeric(...) validation checks a column has only numeric values.

Table Headers¶
The table_headers(...) validation checks that a list of columns exist in a table.

Table Key¶
The table_key(...) validation checks that, for a list of columns, entries for these columns are unique.
For example, running the validation on columns name, age of a table will check that the pairs of name and age entries are unique. A table with just two rows, such as ('David', 21), ('David', 24) would pass the validation. A table with rows like ('David', 21), ('David', 21) would fail. See the following screenshot of notional data as an example.

中文翻译¶
验证结果(Validate results)¶
Fusion 提供了一组验证公式(validation formulas)。这些公式以按钮形式显示,点击后触发执行。若验证失败,系统会显示错误信息并说明原因。
验证函数最好在串行动作(serial Actions)中使用,并结合提示动作(toast Actions)来显示成功或失败消息。更多详情请参阅动作文档。
本文概述了可用的验证公式。如需完整的公式及参数列表,请参见函数库。
枚举验证(Enumerate)¶
column_enum(...) 验证用于检查某列中的条目是否全部属于指定的值列表。列表中的值可以手动输入公式(例如 array('red', 'blue', 'green')),也可以通过引用方式输入(例如 array_flatten(B3:B14))。

非空验证(Not null)¶
column_not_null(...) 验证用于检查某列中是否不存在空值。

数值验证(Numeric)¶
column_numeric(...) 验证用于检查某列是否仅包含数值。

表头验证(Table Headers)¶
table_headers(...) 验证用于检查指定的一组列是否存在于某个表中。

表键验证(Table Key)¶
table_key(...) 验证用于检查指定列组合中的条目是否唯一。
例如,对表中的 name 和 age 列运行此验证,将检查 name 与 age 的条目组合是否唯一。若表中仅有两行数据,如 ('David', 21), ('David', 24),则验证通过;若行数据为 ('David', 21), ('David', 21),则验证失败。以下为示例数据的截图。
