有没有一种方法可以将表格的排序和筛选结合起来?

huangapple go评论65阅读模式
英文:

Is there a way to combine Sort and Filter a table

问题

I'm relatively new to Power Apps and I am trying to sort and filter my table at the same time. Sadly for me it seems to be not working.

Sort(
    Projects;
    Projectnumber;
    SortOrder.Descending
)
Filter(
   Projects;
    StartsWith(
        Projectnumber;
        SearchProject.Text
    ) || StartsWith(
        Designation;
        SearchProject.Text
    )
)

这是我尝试结合的函数。也许使用 SortByColumns 会更好。

我已经在网上查找了一些答案,但所有那里的选项似乎出于某种原因不适用于我的 Power App。

SortByColumns(
    Filter(
        Projects;
        StartsWith(
            Projectnumber;
            SearchProject.Text
        ) || StartsWith(
            Designation;
            SearchProject.Text
        )
   );
    Projectnumber;
    If(varSortDirection = SortOrder.Descending; SortOrder.Ascending; SortOrder.Descending)
)

这是一个应该有效的选项之一,但它给我一个无效参数的错误。

他们是不是随着时间改变了语法,或者为什么这个不起作用?

英文:

I'm relatively new to Power Apps and I am trying to sort and filter my table at the same time. Sadly for me it seems to be not working.

Sort(
        Projects;
        Projectnumber;
        SortOrder.Descending
    )
Filter(
       Projects;
        StartsWith(
            Projectnumber;
            SearchProject.Text
        ) || StartsWith(
            Designation;
            SearchProject.Text
        )
    )

These are the function I am trying to combine. Maybe using SortByColumns would be better.

I have already looked for some answers online but all the options there wont work for some reason on my Power App.

SortByColumns(
    Filter(
        Projects;
        StartsWith(
            Projectnumber;
            SearchProject.Text
        ) || StartsWith(
            Designation;
            SearchProject.Text
        )
   );
    Projectnumber;
    If(varSortDirection = SortOrder.Descending; SortOrder.Ascending; SortOrder.Descending)
)

This was one option that should work but it gives me an Error with Invalid Argument.

Did they change the Syntax of it over time or why wont this work?

答案1

得分: 0

尝试使用这个公式:

Sort(
	Filter(
		Projects;
        StartsWith(Projectnumber; SearchProject.Text) ||
		StartsWith(Designation; SearchProject.Text)
    );
	Projectnumber;
    SortOrder.Descending
)

它应该适用于你。


SortByColumns 函数使用数据源中的内部名称来工作。如果你使用的是 SharePoint 在线列表作为数据源,你可以按照这篇文章获取列的内部名称:如何在 SharePoint Online 中找到列的内部名称?

假设你的列的内部名称是 Projectnumber,你可以使用以下公式:

SortByColumns(
	Filter(
		Projects;
        StartsWith(Projectnumber; SearchProject.Text) ||
		StartsWith(Designation; SearchProject.Text)
    );
	"Projectnumber";
    SortOrder.Descending
)

请注意,列名用双引号括起来,如 "Projectnumber"

英文:

Try using this formula:

Sort(
	Filter(
		Projects;
        StartsWith(Projectnumber; SearchProject.Text) ||
		StartsWith(Designation; SearchProject.Text)
    );
	Projectnumber;
    SortOrder.Descending
)

It should work for you.

<hr>

SortByColumns function works with internal name of columns as available in data source. If you are using SharePoint online list as data source, you can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?

Assuming internal name of your column is Projectnumber, you can use formula like below:

SortByColumns(
	Filter(
		Projects;
        StartsWith(Projectnumber; SearchProject.Text) ||
		StartsWith(Designation; SearchProject.Text)
    );
	&quot;Projectnumber&quot;;
    SortOrder.Descending
)

Notice, column name is wrapped within double quotes like &quot;Projectnumber&quot;.

huangapple
  • 本文由 发表于 2023年6月8日 15:47:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76429661.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定