--- title: "演练:创建数据录入表单 " slug: "walkthrough-build-a-data-entry-form" updated: 2025-05-27T14:53:00Z published: 2025-05-27T14:53:00Z canonical: "support.tulip.co/walkthrough-build-a-data-entry-form" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.tulip.co/llms.txt > Use this file to discover all available pages before exploring further. # 演练:创建数据录入表单 **在本攻略中,你将:*****使用输入部件在步骤中创建输入表单*** **将输入数据保存到变量和表格中*** **查看步骤中的表格记录** 在本练习中,您将学习如何在应用程序中存储数据,以及如何将输入数据从应用程序存储到表格中。 两个练习结束后,您将拥有一个数据录入应用程序,其外观如下:![ex first data entry app walkthrough](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20app%20walkthrough.gif) ## 练习 1:将输入数据保存到应用程序中 在本练习中,您将创建一个将输入数据保存到变量中的基本步骤。 ### 创建新应用程序 1. 在 "**应用程序**"选项卡中,单击 "**应用程序**"。![Apps tab](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Apps%20tab.png) 2. 单击右上角的**+ 创建应用程序**。 3. 将应用程序命名为 "数据输入表单 - 示例"。您可以选择添加说明,以便其他用户知道此应用程序的用途。![ex data entry create new app](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20data%20entry%20create%20new%20app.png) 4. 单击**+ 创建**。 在应用程序详细信息页面,您可以单击右上角的 "**编辑**",或单击**无标题步骤**名称进入应用程序编辑器。 ### 使用可变数据源添加输入部件 1. 单击 "**输入**"选项卡并选择 "**复选框**"。 2. 在**侧窗格**中,命名**标签**:"工单已完成"。 3. 在**数据源**下,单击空框,然后**+** **添加变量**。 4. 将变量命名为 "工单已完成",并将**默认值**更改为 "**否**"。单击**+ 创建**。![ex data entry work order completed variable](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20data%20entry%20work%20order%20completed%20variable.png) 小部件配置将如下所示: ![ex first data entry Input widget side pane config](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20Input%20widget%20side%20pane%20config.png) 1. 从 "**输入 "选项卡**中添加**日期选择器**部件。 2. 在**侧窗格**中,命名**标签**:"已完成日期"。 3. 在**数据源**下,单击空框,然后**+** **添加变量**。 4. 将变量命名为 "完成日期",然后点击**+ 创建**。 小部件配置将如下所示:![ex first data entry input widget config2](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20input%20widget%20config2.png) ### 创建触发器以保存输入数据 1. 单击 "**按钮**"选项卡并选择 "**提交"**。 2. 在**侧窗格**中,单击**触发器**旁边的**+ 加号**。 3. 将触发器命名为 "保存应用程序数据"。 4. 在**"然后**"部分,从下拉菜单中选择**应用程序**。然后选择 "**保存所有应用程序数据**"。单击 "**保存**"。![ex first data entry save app data trigger](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20save%20app%20data%20trigger.png) 现在你有了一个使用变量存储值的基本数据输入步骤。下面是在开发者模式下**测试**应用程序时的样子:![ex first data entry exercise 1 test](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20exercise%201%20test.gif) 请注意,变量存储的是完成数据,您可以在步骤屏幕下方看到。 ## 练习 2:将输入数据存储到表格中 In order to follow this walkthrough, you must first complete the exercises in [Build Your First Table](/r230/docs/walkthrough-build-your-first-table). 在本练习中,您将创建一个数据输入步骤,将值保存到工单表格中。您还可以通过应用程序步骤查看表中的记录。1. 添加一个**新步骤**并将其命名为 "练习 2"。 ### 将表添加到应用程序 1. 单击 "**记录**"选项卡并选择**+ 添加表**。 2. 选择 "**工单**"表,然后单击 "**添加**"。![ex first data entry add table](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20add%20table.gif) 3. 单击**记录占位符**旁边的**+**图标。 4. 将记录占位符命名为"当前工单"。单击**添加记录占位符**。 ![ex first data entry record placeholder](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20record%20placeholder.png){height="" width="""} ### 创建数据表输入 1. **单击**"**输入**"并选择 "**单选**"。 2. 在 "侧窗格 "中,给小工具贴上标签:"产品"。 3. 在**数据选项**下,单击空白**数据源**字段,然后**+ 添加变量**。 4. 将变量命名为 "产品",然后单击**+ 创建**。![ex first data entry product input data source](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20product%20input%20data%20source.gif) 5. 在 "**选择选项**"中,添加以下选项: 6. 自行车车架 7. 车轮 8. 传动系统 ![ex first data entry product selection options](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20product%20selection%20options.png) 1. 在步骤中添加一个**数字输入**widget。 2. 将标签命名为"数量"。 3. 在**数据选项**下,单击空白**数据源**字段,然后**+ 添加变量**。 4. 将变量命名为 "产品",然后单击**+ 创建**。![ex first data entry quantity config](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20quantity%20config.png) 5. 在**验证规则**下,单击**+**添加规则。 6. 选择**大于**,然后键入 "0 "作为静态值。 ![ex first data entry validate quantity input](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20validate%20quantity%20input.gif) ### 创建按钮触发器以存储输入值 1. 在步骤中添加一个**按钮**。 2. 在侧窗格中添加文本:"创建工单"。 3. 在**"触发器**"下单击 "**+**"。 4. 为触发器命名:"将输入值存储到新的工单记录中"。 5. 在触发器中添加以下操作: 6. 表记录 → 创建记录 → 表达式:`RANDOMSTRING()`→ 当前工单 7. 数据操作 → 存储 → 变量 → 产品 → 表记录 → 当前工单 → 产品 8. 数据操作 → 存储 → 变量 → 数量 → 表记录 → 当前工单 → 数量 ![ex first data entry trigger actions](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20trigger%20actions.png) ### 在步骤中查看工单表 1. 单击 "**嵌入 "**并选择 "**交互表**"。 2. 在**数据源**下的**侧窗格**中,选择**郁金香表**。 3. 在下一个**下拉菜单**中,选择**工单表**。 4. 在**链接占位符下**,选择**当前工单**。![ex first data entry interactive table datasource](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20interactive%20table%20datasource.png) 5. 在 "字段 "下,添加以下字段: 6. ID 7. 产品 8. 数量 9. 创建日期 10. 状态 11. 颜色 ![ex first data entry interactive table fields](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20interactive%20table%20fields.png){height="" width="""} 1. 单击并拖动 widget 周围的方格,调整尺寸并查看所有字段。![ex first data entry adjust interactive table](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20adjust%20interactive%20table.gif) 现在你有了一个数据输入表单,它可以将变量存储到记录占位符中,并从当前占位符创建表格记录。下面是在开发人员模式下测试时的步骤: ![ex first data entry exercise 2 test](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20exercise%202%20test.gif){height="" width="""} 如果在数量中输入 "0",就会出现一条错误信息,提示用户输入一个可接受的值。这是通过在 widget 上设置的**验证规则**实现的。![ex first data entry number widget error message](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/ex%20first%20data%20entry%20number%20widget%20error%20message.png) ## 下一步 现在您已经创建了一个数据输入表单,可以学习一下应用程序的构建或如何将数据可视化: - [演练:创建第一个应用程序](/r230/docs/walkthrough-build-your-first-app) - [演练:创建第一个分析](/r230/docs/walkthrough-create-your-first-analysis)