跳转至

Generate a primary key(生成主键)

:::callout{theme="warning"} Foundry Forms is no longer the recommended approach for data entry or writeback workflows on Foundry. Instead, build user input workflows with the Foundry Ontology, representing the relevant data structures as object types and configuring the writeback interaction with Actions. Learn more in the Forms overview documentation. :::

A primary key is a value that uniquely identifies each row in a dataset. With Fusion-backed forms, a user can define or automatically generate such a value.

Ideally, the field writing to the primary key column should not be editable. Instead, the field should automatically generate a unique value (hidden or otherwise) such as a timestamp or the concatenation of other fields.

To set the primary key:

  1. With the form configured with at least one field, select the Response data tab.
  2. Find the Table columns section at the bottom of the panel.
  3. Select the key icon to the right of the desired field.

:::callout{theme="neutral"} If the primary key field has no value, a unique one will automatically be generated. :::

:::callout{theme="warning"} If the primary key field has a non-unique value, a new row will still be created, but the column will no longer have unique values. :::


中文翻译

生成主键

:::callout{theme="warning"} Foundry Forms 已不再是 Foundry 上数据录入或回写工作流的推荐方案。请改用 Foundry Ontology 构建用户输入工作流,将相关数据结构表示为对象类型,并通过 Actions 配置回写交互。更多信息请参阅 Forms 概述文档。 :::

主键(primary key)是唯一标识数据集中每一行的值。使用 Fusion 驱动的表单时,用户可以定义或自动生成此类值。

理想情况下,写入主键列的字段不应可编辑。相反,该字段应自动生成唯一值(可隐藏或其他形式),例如时间戳或其他字段的组合

设置主键的步骤如下:

  1. 在表单配置了至少一个字段的情况下,选择 Response data(响应数据)选项卡。
  2. 在面板底部找到 Table columns(表列)部分。
  3. 点击所需字段右侧的键图标。

:::callout{theme="neutral"} 如果主键字段没有值,系统将自动生成唯一值。 :::

:::callout{theme="warning"} 如果主键字段包含非唯一值,仍会创建新行,但该列将不再具有唯一值。 :::