activities
latest
false
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

工作流活动

上次更新日期 2026年3月9日

动态汇总两个文本字段

触发器类型: JavaScript操作类型:

此高级逻辑根据用户与相应文本字段交互的条件汇总两个文本字段。

在运行时,如果业务用户与文本字段 AB进行交互,则 Total 字段将自动填充,并显示 A 和 B 的总和。

  1. 在 Studio 中打开或创建一个表单文件。

  2. 在表单中添加三个“文本字段”组件。

  3. 将两个文本字段组件命名为AB ,将第三个组件命名为Total 。在高级逻辑中使用这些值时,请注意其“属性名称”

    (可选)您可以将Total文本字段组件设置为“禁用” ,使业务用户无法与之交互。

  4. Go to the Logic tab of the Total field component.

  5. 添加一个逻辑并将其命名为 "dynamic sum"

  6. Select the Javascript trigger type, and enter the following script in the Text Area section:

    result = true;
    return result;
    result = true;
    return result;
    

    上面的代码片段检测文本字段中是否有任何更改,即用户与文本字段的交互,并触发 Actions 以汇总字段。

  7. 添加一个 Actions 并将其命名为 "a+b"

  8. Select the Value action type, and enter the following script in the Value (Javascript) section:

    result = (+data.a) + (+data.b);
    return result;
    result = (+data.a) + (+data.b);
    return result;
    

    ab 替换为文本字段组件的字段键值。

  9. 保存操作和逻辑。

  10. 保存组件。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新