--- title: "How to Use the Expression Editor in the App Editor" slug: "how-to-use-the-expression-editor-in-the-app-editor" updated: 2023-10-31T15:21:17Z published: 2023-10-31T15:21:17Z canonical: "support.tulip.co/how-to-use-the-expression-editor-in-the-app-editor" --- > ## 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. # 如何在应用程序编辑器中使用表达式编辑器 *下面介绍如何使用 Expression Editor 构建功能更强大的应用程序。* ## 使用目的 表达式是在触发器中修改文本和数值的强大工具。您可以修改 1. **表记录:**在之前的语句中加载到应用程序中的记录 2. **应用程序信息:**默认应用程序字段,如用户、站和步骤所用时间 3. **变量:**触发器触发时应用程序运行时的变量值。 常见用例包括 1. 将文本转换为数字 2. 将数字转换为文本 3. 修改条形码扫描仪的输出 4. 将静态文本与变量值相结合 如果计划在文本字符串中使用变量值,则应使用表达式编辑器,而不是 "静态值""文本"。 ## 访问表达式编辑器 表达式编辑器可作为 "If "语句中的初始选项,也可作为 "Then "语句中的操作选项。 在 "如果 "语句中,可以根据表达式编写逻辑。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_92858705.png) 在 "然后 "语句中,它可以在 "数据处理""存储 "等操作中使用。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_103727174.png) ## 编写表达式 要使用表达式,必须插入一个 - 变量 - 表记录字段 - 应用程序字段 - 静态值 插入表达式中的括号内。 在下面的示例中,变量 "条形码 "的值被添加到 TEXTTONUMBER() 函数中。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_397005146.png) - "数据处理" "存储 "数据:"表达式""TEXTTONUMBER(变量.条形码)" 如果表达式有效,编辑器底部会显示 "有效表达式 "信息。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_397003372.png) 如果打算在文本字符串中使用变量值,必须使用引号(")包围文本字符串,并使用加号(+)连接变量值和字符串。 例如 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_129418847.png) 文本:我的工单 ID 是:' + @Table Record.Test WO Record.ID + '我的徽章 ID 是:' + @App Info.Logged-in User.Badge Id ## 常见用例说明 ### 将文本转换为数字 要将文本转换为数字,首先必须决定是要将数字转换为浮点数(带小数位)还是整数。 假设您想将文本转换为浮点数。下面是您的操作方法: ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_397014562.png) - "数据处理" "存储 "数据:"Expression" "PARSEFLOAT("123.14") 这将把 "123.14 "转换为 123.14。 ### 将数字转换为文本 由于表格需要文本值作为唯一 ID,因此需要将数字转换为文本。 为此,只需使用 "+"操作符在数字后添加一组引号即可。 ![NumberString](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/NumberString.png) - "数据操作" "存储 "数据:"表达式" - 123.456 + "" - 注意--"+"后必须是两个双引号("")或两个单引号('')。 您可以将其视为 "TOTEXT "表达式。 ### 修改条码扫描仪输出 首先,您必须确定条形码扫描仪输出的格式。假设它是文本,您想将其转换为数字。 为此,您必须在扫描仪输出上使用 TEXTTONUMBER()。它看起来像这样 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_397021692.png) - "数据处理" "存储 "数据:"表达式 - TEXTTONUMBER(设备输出.数据) - 位置:"work_order ### 创建逗号分隔的值列表 您可以将多个字符串或数字合并为一个字符串,每个值用逗号分隔。您可以将其添加到表格中的现有字段中,也可以简单地将多个变量或静态值组合在一起。 下面介绍如何将存储在 2 个变量中的值合并为一个文本值: ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_142542592.png) - "数据处理" "存储 "数据:"表达式" - Variable.Defect Report-Defect Type + "," + Variable.Defect Report-Defect Type + "," + Variable.Defect Report-Defect Type缺陷报告-缺陷描述 ### 在文本中添加新行 比方说,您想与主管共享应用程序的完成结果。为此,您可以通过触发器发送电子邮件。在表达式编辑器中输入封闭引号时,按 SHIFT+ ENTER 键,就可以在电子邮件文本中添加新行。如下所示 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Expression%20Editor%20in%20the%20App%20Editor_163373245.png) 表达式: 这是第 1 行 ' + '这是第 2 行 这是第三行 ## 更多阅读 - [表达式编辑器中的函数和运算符列表](/r230/docs/technical-details-of-the-expression-editor) - [如何在应用程序中比较两个时间戳](https://support.tulip.co/docs/how-to-run-date-and-time-calculations-in-apps) --- 找到您想要的东西了吗? 您还可以前往[community.tulip.co](https://community.tulip.co/?utm_source=intercom&utm_medium=article-link&utm_campaign=all)发布您的问题,或查看其他人是否遇到过类似问题!