简体   繁体   English

带有 sort() 和 distinct() 的 PowerApp Gallery

[英]PowerApp Gallery with sort() and distinct()

I created a Gallery with a Title == Name and a subtitle == First Name by item.我创建了一个带有标题 == 名称和副标题 == 名字的画廊。

I want this gallery to be sorted and remove duplicates.我希望对这个画廊进行排序并删除重复项。

I tried this:我试过这个:

Sort(Distinct(Data_source, Name), Result)

The problem is that I get Title == Name and subtitle == Name instead of Fisrt Name.问题是我得到 Title == Name 和 subtitle == Name 而不是 Fisrt Name。

How can I keep different fields?如何保留不同的字段?

Thanks谢谢

As you noticed, the Distinct function will only return the distinct values from the selected column, and discard the other ones.如您所见, Distinct function将仅返回所选列中的不同值,并丢弃其他值。 If you want to preserve the other values, you can use the GroupBy function , and take one of the elements of the group.如果要保留其他值,可以使用GroupBy function ,并取组中的一个元素。 Something along the lines of the expression below:类似于以下表达式的内容:

ForAll(
    GroupBy(
        Data_source,
        "Name",
        "ByName"),
    Patch(
        { Name: ThisRecord.Name },
        First(ThisRecord.ByName)
    )
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM