Hello!
I got this problem where I try to sort on a date/time column (Last contact) from an SP list in Powerapps and for some reason it doesnt work.
This code gives no errors but the gallery is just blank:
If('Toggle'.Value;
Filter(
Sort(
'Logg';
'Last contact';Ascending);
Agreementarea.Value in "Location1" & "Location2";
Status.Value in "Ongoing" & "Finished"
);
Filter(
Sort(
'Logg';
'Last contact';Ascending);
Agreementarea.Value in 'Filter agreementarea'.SelectedItems.Value ;
Status.Value in "Ongoing" & "Finished"
))
What i'm trying to accomplish is that you can filter with a dropdown meny called "Filter agreementarea" or toggle a button and instant get all choices in the agreementarea shown in the gallery
Solved! Go to Solution.
Hi @Anonymous ,
OK, obviously the formula isn't delegable because of the in operator, not to mention, you have 11K rows data, so I suspect that it's a delegation issue. What you filter exceed the maximum threshold (2000), the gallery only shows blank.
If my assumption is correct, here is a workaround for this issue.
1. set OnChange property of "Filter agreementarea" combox as follows, save each selected option into variable.
Concurrent(
Set(
v1,
Last(
FirstN(
Self.SelectedItems,
1
)
).Value
),
Set(
v2,
Last(
FirstN(
Self.SelectedItems,
2
)
).Value
),
Set(
v3,
Last(
FirstN(
Self.SelectedItems,
3
)
).Value
),
Set(
v4,
Last(
FirstN(
Self.SelectedItems,
4
)
).Value
),
Set(
v5,
Last(
FirstN(
Self.SelectedItems,
5
)
).Value
)
)
2. modify the Gallery.Items property as follow, remove In operator, change to user = operator to match each criterion.
If('Toggle'.Value;
Filter(
Sort('Logg';'Last contact';Ascending);
Agreementarea.Value = "Location1" ||
Agreementarea.Value = "Location2";
Status.Value = "Ongoing" ||
Status.Value = "Finished"
);
Filter(
Sort('Logg';'Last contact';Ascending);
Agreementarea.Value = v1 || Agreementarea.Value = v2 || Agreementarea.Value = v3 || Agreementarea.Value = v4 || Agreementarea.Value = v5 ||;
Status.Value = "Ongoing" ||
Status.Value = "Finished"
))
Hope this helps.
Sik
@Anonymous ,
You have just posted the same code that we have spend 26 posts correcting on this thread.
Obviously, you do not wish further assistance from me, but whoever picks this one up needs to know the history or they will be starting from the beginning. Your problem is not your sort - it is your filters, which I believe have already been corrected in the other thread and yet you post the originals code again.
Is there anyone who can help me? 🙂
Hey guys! I really need some help with this. I really appreciate the help!
Hi @Anonymous ,
Can the code work properly without any sort() function? What is the Items property of 'Filter agreementarea' combobox?
The code looks good, if the code without the sort() function can work perfectly, how about trying some other sort functions?
Try this out:
SortByColumns(
If('Toggle'.Value;
Filter(
'Logg';
Agreementarea.Value in "Location1" & "Location2";
Status.Value in "Ongoing" & "Finished"
);
Filter(
'Logg';
Agreementarea.Value in 'Filter agreementarea'.SelectedItems.Value ;
Status.Value in "Ongoing" & "Finished"
)
);"Last contact";Ascending)
Hope this helps.
Sik
@v-siky-msft Hello!
My code doesnt seem to work when I try without the Sort() function..
This is the item property of the "Filter agreementarea" combox:
Choices(Logg.Agreementarea)
I tried the code you provided and the gallery is just blank 😞
Hi @Anonymous ,
So, it seems the problem isn't due to the sort function, because the filter formula doesn't even work.
Please share more information about your scenario.
What are the data types of these columns in Logg list?
How many rows are there in in Logg list?
Could you please share more snapshots to display what you want to achieve?
Sik
@v-siky-msft There is over 11k rows in this sharepoint list, but that what the filter is for.
Columns in logg list:
Last contact = an date/time field in SP list where users with a lookup can choose date and time, as seen in the screenshot of my first post.
ThisItem.'Last contact"
Agreementarea = An choice field in SP list where you can only choose 1 alternative out of 5.
Items property:
Choices('Logg'.Agreementarea)
Status = An choice field in SP list where you can only choose 1 alternative out of 6.
Item property:
Choices('Logg'.Status)
As I explained before, you can choose to either sort by "Sortera på avtalsområde" (Filter agreementarea) or use the toggle to show some other filters, toggle should overwrite the other filter.
@Anonymous ,
I will leave you with @v-siky-msft , but you are being told the same thing I spent 13 posts telling you on this thread.
Hi @Anonymous ,
OK, obviously the formula isn't delegable because of the in operator, not to mention, you have 11K rows data, so I suspect that it's a delegation issue. What you filter exceed the maximum threshold (2000), the gallery only shows blank.
If my assumption is correct, here is a workaround for this issue.
1. set OnChange property of "Filter agreementarea" combox as follows, save each selected option into variable.
Concurrent(
Set(
v1,
Last(
FirstN(
Self.SelectedItems,
1
)
).Value
),
Set(
v2,
Last(
FirstN(
Self.SelectedItems,
2
)
).Value
),
Set(
v3,
Last(
FirstN(
Self.SelectedItems,
3
)
).Value
),
Set(
v4,
Last(
FirstN(
Self.SelectedItems,
4
)
).Value
),
Set(
v5,
Last(
FirstN(
Self.SelectedItems,
5
)
).Value
)
)
2. modify the Gallery.Items property as follow, remove In operator, change to user = operator to match each criterion.
If('Toggle'.Value;
Filter(
Sort('Logg';'Last contact';Ascending);
Agreementarea.Value = "Location1" ||
Agreementarea.Value = "Location2";
Status.Value = "Ongoing" ||
Status.Value = "Finished"
);
Filter(
Sort('Logg';'Last contact';Ascending);
Agreementarea.Value = v1 || Agreementarea.Value = v2 || Agreementarea.Value = v3 || Agreementarea.Value = v4 || Agreementarea.Value = v5 ||;
Status.Value = "Ongoing" ||
Status.Value = "Finished"
))
Hope this helps.
Sik
User | Count |
---|---|
254 | |
106 | |
95 | |
50 | |
39 |