apps
latest
false
重要 :
有关 Studio Web 中的应用程序项目文档,请参阅 Studio Web 文档中的“应用程序项目”一章:https://docs.uipath.com/zh-CN/studio-web/automation-cloud/latest/user-guide/apps-in-studio-web。 请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

Apps 用户指南

上次更新日期 2025年10月23日

查询构建器

查询生成器允许您筛选 Data Service 实体中的数据,同时遵循预定义的语法。

重要提示:
FetchFetchOneGetChoiceSetGetChoiceSetValue函数是异步函数,并且不支持链接。

要在控件中显示实体记录请使用应用程序变量和“设置值”规则。 您还可以使用查询生成器将控件数据源绑定到实体。

有关实际示例,请参阅使用 Fetch 函数

提示:要在页面加载或单击按钮时刷新实体变量,请添加“设置值”规则。在设置值规则中打开“查询生成器”,并为“UpdateTime <= now( )”添加一个筛选条件。

使用查询生成器

查询生成器使用 Fetch() 函数对 Data Service 实体进行评估和排序。

作为先决条件,您必须将现有 Data Service 实体引用到应用程序中。要使用查询生成器,请继续执行以下步骤:

  1. 对于所需的控件,选择“已启用 VB”属性。您可以通过“常规”选项卡中的“VB 数据源”字段来识别这些属性类型。
    docs image
  2. 选择“查询生成器”。系统将打开“查询生成器”窗口。
  3. 选择要为其构建查询的实体。
  4. 在“条件”选项卡上,单击:
    选项描述

    添加条件

    添加单个条件

    添加组

    对多个条件进行分组

    添加两个或更多条件时,查询将根据 ANDOR 运算符评估并返回数据:

    • AND - 返回满足所有条件的数据

    • OR - 返回满足任意条件的数据

  5. 选择要从中查询数据的实体字段。
  6. 选择评估运算符。
  7. 输入条件的值。值的类型必须与字段类型相同。例如,对“文本”字段使用字符串,对“数字”字段使用整数。
  8. Optionally, configure rules for the queried data on the Additional settings tab.
  9. Select Save to save your query.

其他设置

On the Additional settings tab, you can configure rules for the queried data.

The following table describes the elements of the Additional settings tab.

元素描述
Page start index (skip)

Enables you to define how many records to skip before starting to return results.

For example, if you enter 10, the query starts from the 11th record.

Note: Setting a Page start index can be useful for pagination when using large datasets.
Page limit (top)

Enables you to set the maximum number of records to return.

For example, if you enter 50, the query returns the first 50 rows.

Note: Setting a Page limit helps control query size.
Add sort field

Adds a sort field that allows you to configure a sorting rule for the queried data.

The Sort by field and the Sort ascending elements display.

按字段排序Enables you to enter the field you to use for sorting the data.
升序排列如果为 True,则按升序对查询的数据进行排序。
ProjectionEnables you to define a specific field from the entity that only should be included in the result set.
备注: Projection can can be used to simplify output data.

Fetch 函数

查询生成器使用Fetch()函数来检索和操作实体数据。 Fetch()函数是异步函数,并且不支持链接。
Fetch() 函数具有以下参数:

参数

描述

FilterGroup

Data Service 中的一组筛选器

PaginationProps

指定页面大小和要跳过的记录数。

SortOption[] sortOptions

指定要排序的列和排序顺序。

string[] selectedFields

指定应返回的实体字段。

ExpansionFieldOption[] expansionFieldOptions

指定应展开并返回关系实体的列。

Apps 允许一级扩展,这意味着如果您有关系字段,则表达式需要一级属性才可访问。

查询生成器会自动添加这些属性,并且它们对于非系统实体是必需项。

The FetchOne() function

Fetch() 返回 ListSource<T> 时,其类型与列表控件相同,而 FetchOne() 返回类型为 T 的单个记录。
Fetch()函数一样, FetchOne()函数是异步函数,并且不支持链接。
对于以下场景,您需要手动修改 Fetch() 函数,以获得更多自定义结果:

简单提取

获取实体的记录数,例如 SystemUsers

Fetch(of SystemUsers)()Fetch(of SystemUsers)()

使用筛选条件获取

Fetch(of SystemUsers)(createFilterGroup(new QueryFilter(){addFilter("Name", "=", "You")}), new PaginationProps(0, 10))Fetch(of SystemUsers)(createFilterGroup(new QueryFilter(){addFilter("Name", "=", "You")}), new PaginationProps(0, 10))

使用筛选条件和排序顺序(升序)获取

Fetch(of SystemUsers)(createFilterGroup(new QueryFilter(){addFilter("Name", "=", "You")}), new PaginationProps(0, 10), new SortOption(){addSortOption("Date")})Fetch(of SystemUsers)(createFilterGroup(new QueryFilter(){addFilter("Name", "=", "You")}), new PaginationProps(0, 10), new SortOption(){addSortOption("Date")})

使用筛选条件和排序顺序(降序)获取

Fetch(of SystemUsers)(createFilterGroup(new QueryFilter(){addFilter("Name", "=", "You")}), new PaginationProps(0, 10), new SortOption(){addSortOption("Date", true)})Fetch(of SystemUsers)(createFilterGroup(new QueryFilter(){addFilter("Name", "=", "You")}), new PaginationProps(0, 10), new SortOption(){addSortOption("Date", true)})

使用静态分页属性获取

Fetch(of SystemUsers)(Nothing, new PaginationProps(0, 100))Fetch(of SystemUsers)(Nothing, new PaginationProps(0, 100))

使用控件绑定的静态分页属性获取

例如,对于“编辑网格”控件:

Fetch(of SystemUsers)(Nothing, new PaginationProps(MainPage.EditableGrid.PageStart, MainPage.EditableGrid.PageLimit))Fetch(of SystemUsers)(Nothing, new PaginationProps(MainPage.EditableGrid.PageStart, MainPage.EditableGrid.PageLimit))

使用投影获取

Fetch(of SystemUsers)(createFilterGroup(new QueryFilter(){addFilter("Name", "=", "You")}), new PaginationProps(0, 10), Nothing, new string(){"Name"})Fetch(of SystemUsers)(createFilterGroup(new QueryFilter(){addFilter("Name", "=", "You")}), new PaginationProps(0, 10), Nothing, new string(){"Name"})

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo
信任与安全
© 2005-2025 UiPath。保留所有权利。