【问题标题】:Store a manipulated collection in Power Apps在 Power Apps 中存储操纵的集合
【发布时间】:2021-12-21 08:41:53
【问题描述】:

(1) 在我的 Canvas 应用程序中,我创建了一个这样的集合:

Collect(colShoppingBasket; {Category: varCategoryTitle ; Supplier: lblSupplier.Text ; ProductNumber: lblProductNumber.Text });;

它有效 - 我得到了一个集合。每当我按下“添加到购物篮”按钮时,就会有一件物品被添加到我的收藏中。

(2) 现在我想对集合进行排序,然后将排序后的输出用于其他事情。

此功能按供应商排序。这里没有问题:

Sort(colShoppingBasket; Supplier)

(3) 然后我想在各种场景中显示集合的SORTED版本。这就是问题所在。因为我所能做的就是操作集合“colShoppingBasket”的显示 - (未排序)。

(4) 真正好的选择是创建和存储原始集合的操纵副本。以及我需要的任何地方的显示器。排序:

Collect(colShoppingBasketSORTED; { Sort(colShoppingBasket; supplier) });; <--- p.s. I know this is not a working function

【问题讨论】:

    标签: collections powerapps powerapps-canvas


    【解决方案1】:

    您可以使用以下内容:

    ClearCollect(colShoppingBasketSorted, Sort(colShoppingBasket, Supplier))
    

    请注意,它是 没有 { }

    这将清除并收集排序后的整个 colShoppingBasket。

    如果要将表存储在集合中的单行中,可以使用

    ClearCollect(colShoppingBasketSortedAlternative, {SingleRow: Sort(colShoppingBasket, Supplier)})
    

    我不建议这样做,因为如果你想使用排序值,你必须这样做:

    First(colShoppingBasketSortedAlternative).SingleRow -> this returns the first records of the colShoppingBasketSortedAlternative then gets the content of the SingleRow column, which in this case is a Collection
    

    注意:您需要将 , 替换为 ;处理你的案子

    【讨论】:

      猜你喜欢
      • 2019-08-05
      • 1970-01-01
      • 2019-09-14
      • 1970-01-01
      • 1970-01-01
      • 2021-03-13
      • 2022-10-23
      • 2020-04-11
      • 1970-01-01
      相关资源
      最近更新 更多