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

Apps 用户指南

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

自定义 VB 函数

函数:Serialize

  • 函数:String Serialize(Object value)
  • 说明:返回指定对象的字符串表示形式。

  • 示例:

    Serialize(Queues.testQueue.arg1)Serialize(Queues.testQueue.arg1)

函数:Deserialize

  • 函数:T Deserialize<T>(string obj)
  • 说明:返回类型为 T 的对象。接受对象的有效 JSON 字符串表示形式作为输入。

  • 示例

    Deserialize(Of AppsFile)(textV)Deserialize(Of AppsFile)(textV)
    其中textV是类型为Text的变量,包含对象的序列化字符串。

函数:App.QueryParam

适用于对象

  • 函数:

    T? App.QueryParam<T>((string param, T? defaultValue = default(T))

  • 说明:

    • 如果在 URL 中传递查询参数,则函数将返回根据泛型类型 T 反序列化的值。

    • 如果反序列化失败或 URL 中未传递查询参数,则函数将返回默认值。

  • 示例

    App.QueryParam(Of AppsFile)("file", new AppsFile("https://i0.wp.com/
    imagelinkmri.com/wp-content/uploads/2021/08/imagelink-04.png"))App.QueryParam(Of AppsFile)("file", new AppsFile("https://i0.wp.com/
    imagelinkmri.com/wp-content/uploads/2021/08/imagelink-04.png"))

适用于字符串

  • 函数:

    string App.QueryParam(string param, string? defaultValue = "")

  • 说明:

    • 如果在 URL 中传递查询参数,则函数会以字符串形式返回该值。

    • 如果 URL 中未传递查询参数,则函数将返回默认值。

  • 示例

    App.QueryParam("stringVariable", "defaultText")App.QueryParam("stringVariable", "defaultText")

函数:Add item to list

  • 函数:List<T> AddItemToList<T>(List<T> list, T value)
  • 说明:给定类型为 T 的列表,将项目附加到列表并返回更新后的列表。

  • 示例

    AddItemToList(Of String)(stringList, "AddMe")AddItemToList(Of String)(stringList, "AddMe")

函数:Update list item at index

  • 函数:

    List<T> UpdateListItemAtIndex<T>(List<T> list, int index, T value)

  • 说明:给定类型为 T 的列表,更新指定索引处的项目,并返回更新后的列表。

  • 示例

    UpdateListItemAtIndex(Of String)(stringList, MainPage.EditGrid.RowIndex,"UpdateValue")UpdateListItemAtIndex(Of String)(stringList, MainPage.EditGrid.RowIndex,"UpdateValue")

函数:Delete item from list

  • 函数:

    List<T> DeleteItemFromList<T>(List<T> list, int index)

  • 说明:给定类型为 T 的列表,删除指定索引处的项目并返回更新后的列表。

  • 示例

    DeleteItemFromList(Of String)(stringList, MainPage.EditGrid.RowIndex)DeleteItemFromList(Of String)(stringList, MainPage.EditGrid.RowIndex)

函数:Fetch

This function is used by the Query builder. Refer to The Fetch function for more details on this function, and how to use it in practice.

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

To display an entity record in a control, bind the control data source to the entity using the Query builder. Refer to Using the Fetch functions for a practical example.

  • 函数:

    ListSource<T> Fetch<T>(FilterGroup group = null, PaginationProps paginationProps = null, SortOption[] sortOptions = null, string[] selectedFields = null, ExpansionFieldOption[] expansionFieldOptions = null )

  • 说明:根据上述参数返回实体对象的所有记录。

  • 示例

    Fetch(of AlexEntity)(createFilterGroup(Nothing, New FilterGroup(){createFilterGroup(New QueryFilter(){addFilter(MainPage.EditGrid.SearchColumn, "contains", MainPage.EditGrid.SearchTerm)}, Nothing, 0)}, 0), New PaginationProps(MainPage.EditGrid.PageStart, MainPage.EditGrid.PageLimit), New SortOption(){addSortOption(MainPage.EditGrid.SortColumn, Not(Not(MainPage.EditGrid.isDescending)))}, Nothing, New ExpansionFieldOption(){addExpansionFieldOption("CreatedBy", New String(){"Id","Name"}), addExpansionFieldOption("UpdatedBy", New String(){"Id","Name"})})Fetch(of AlexEntity)(createFilterGroup(Nothing, New FilterGroup(){createFilterGroup(New QueryFilter(){addFilter(MainPage.EditGrid.SearchColumn, "contains", MainPage.EditGrid.SearchTerm)}, Nothing, 0)}, 0), New PaginationProps(MainPage.EditGrid.PageStart, MainPage.EditGrid.PageLimit), New SortOption(){addSortOption(MainPage.EditGrid.SortColumn, Not(Not(MainPage.EditGrid.isDescending)))}, Nothing, New ExpansionFieldOption(){addExpansionFieldOption("CreatedBy", New String(){"Id","Name"}), addExpansionFieldOption("UpdatedBy", New String(){"Id","Name"})})

函数:Fetch one

This function is used by the query builder, and should not be confused with the Fetch function. Refer to The Fetch function for details on the differences between these two functions, and how to use them in practice.

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

To display entity records in a control,, use an app variable and the Set Value rule.

Refer to Using the Fetch functions for a practical example.

  • 函数:

    T FetchOne<T>(FilterGroup group = null, PaginationProps paginationProps = null, SortOption[] sortOptions = null, string[] selectedFields = null, ExpansionFieldOption[] expansionFieldOptions = null)

  • 说明:根据上述参数返回实体对象的单个记录。

  • 示例

    FetchOne(of Employee)(
            createFilterGroup(new QueryFilter(){addFilter(
                MainPage.EditGrid.SearchColumn,"contains",MainPage.EditGrid.SearchTerm)}),
                new PaginationProps(MainPage.EditGrid.PageStart, MainPage.EditGrid.PageLimit),
                new SortOption(){
                    addSortOption(
                        MainPage.EditGrid.SortColumn,MainPage.EditGrid.isDescending)
                    }
    )FetchOne(of Employee)(
            createFilterGroup(new QueryFilter(){addFilter(
                MainPage.EditGrid.SearchColumn,"contains",MainPage.EditGrid.SearchTerm)}),
                new PaginationProps(MainPage.EditGrid.PageStart, MainPage.EditGrid.PageLimit),
                new SortOption(){
                    addSortOption(
                        MainPage.EditGrid.SortColumn,MainPage.EditGrid.isDescending)
                    }
    )

函数:Create filter group

此函数由查询生成器使用。

  • 函数:

    FilterGroup createFilterGroup(QueryFilter[] queryFilters, FilterGroup[] groups = null, int isAnd = 0)

  • 说明:给定查询筛选器和筛选器组的数组,生成筛选器组。

  • 示例

    createFilterGroup(Nothing, New FilterGroup(){createFilterGroup(New QueryFilter(){addFilter(MainPage.EditGrid.SearchColumn, "contains", MainPage.EditGrid.SearchTerm)}, Nothing, 0)}, 0)createFilterGroup(Nothing, New FilterGroup(){createFilterGroup(New QueryFilter(){addFilter(MainPage.EditGrid.SearchColumn, "contains", MainPage.EditGrid.SearchTerm)}, Nothing, 0)}, 0)

函数:Add filter

此函数由查询生成器使用。

  • 函数:

    QueryFilter addFilter(string columnName, string colOperator, string value)

  • 说明:给定列名称、运算符和值,生成查询筛选器。

  • 示例

    addFilter(MainPage.EditGrid.SearchColumn, "contains", MainPage.EditGrid.SearchTerm)addFilter(MainPage.EditGrid.SearchColumn, "contains", MainPage.EditGrid.SearchTerm)

函数:Add sort option

此函数由查询生成器使用。

  • 函数:

    SortOption addSortOption(string columnName, bool isDescending = false)

  • 说明:给定列名称和排序值,生成查询筛选器并进行排序。

  • 示例

    addSortOption(MainPage.EditGrid.SortColumn, Not(Not(MainPage.EditGrid.isDescending)))}addSortOption(MainPage.EditGrid.SortColumn, Not(Not(MainPage.EditGrid.isDescending)))}

函数:Get choice set

重要提示:
  • GetChoiceSet()函数是异步函数,并且不支持链接。
  • 必须将托管选项集的实体添加到您的应用程序。

  • 函数:

    ListSource<ChoiceSet> GetChoiceSet(string choiceSetName)

  • 说明:给定 Data Service 选项集的名称,返回选项集中的所有值。

  • 示例

    GetChoiceSet("Gender")GetChoiceSet("Gender")

函数:Get choice set value

重要提示:
  • GetChoiceSet()函数是异步函数,并且不支持链接。
  • 必须将托管选项集的实体添加到您的应用程序。

  • 函数:

    string GetChoiceSetValue(string choiceSetName, int numberId)

  • 说明:给定 Data Service 选项集的名称和选项集选项的索引,返回指定的选项。

  • 示例

    GetChoiceSetValue("Gender", 0)GetChoiceSetValue("Gender", 0)

函数:Build data table

  • 函数:

    DataTable BuildDataTable(DataTable dt, DataColumn[] columns, List<Object> rowData, bool clear=false)

  • 说明:加载包含“设置值”规则中的列和行的数据表,并返回更新的数据表。

    如果 clear 参数为 True,则会清除数据表的列和行中的内容。
  • 示例

    BuildDataTable(
        New DataTable("TestDT"), 
        New DataColumn(){ New DataColumn("Name"), New DataColumn("Age")},
        New List(Of Object) From { 
            AddDataRow(New Object(){"Baishali", "30"}), 
            AddDataRow(New Object(){"Viswa", "33"}) 
        },
        True
    )BuildDataTable(
        New DataTable("TestDT"), 
        New DataColumn(){ New DataColumn("Name"), New DataColumn("Age")},
        New List(Of Object) From { 
            AddDataRow(New Object(){"Baishali", "30"}), 
            AddDataRow(New Object(){"Viswa", "33"}) 
        },
        True
    )

函数:Add row

  • 函数:AddRow(DataRow row)
  • 说明:数据表扩展方法,可将指定的行添加到数据表并返回更新的实例。

  • 示例

    dt.AddRow(row)dt.AddRow(row)

函数:Delete row

  • 函数:DeleteRowAt(int index)
  • 说明:数据表扩展方法,用于删除数据表中指定索引处的行并返回更新后的实例。

  • 示例

    dt.DeleteRowAt(2)dt.DeleteRowAt(2)

函数:Update row at

  • 函数:UpdateRowAt(int index, DataRow row)
  • 说明:数据表扩展方法,使用新的行数据更新指定索引处的行,并返回更新后的数据表。

  • 示例

    dt.UpdateRowAt(2, row)dt.UpdateRowAt(2, row)

函数:Update单元格位于 (使用列索引)

  • 函数:UpdateCellAt(int rowIndex, int columnIndex, object value)
  • 说明:数据表扩展方法,该方法在指定的行索引和列索引处更新数据表的单元格。

  • 示例

    dt.UpdateCellAt(0, 2, "Hi")dt.UpdateCellAt(0, 2, "Hi")

函数:Update单元格位于 (使用列名称)

  • 函数:UpdateCellAt(int rowIndex, string columnName, object value)
  • 说明:数据表扩展方法,该方法在指定的行索引和列名称处更新数据表的单元格。

  • 示例

    dt.UpdateCellAt(0, "Greetings", "Hi")dt.UpdateCellAt(0, "Greetings", "Hi")

此页面有帮助吗?

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