英文:
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)
);
"Projectnumber";
SortOrder.Descending
)
Notice, column name is wrapped within double quotes like "Projectnumber"
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论