Hey, I want to sort a gallery with the nodes closest to the user, but I have to do it on a dataset of around 3700 rows. I have already done it with 2000 rows (because of the limit), but I am struggling with that in the last 1700 rows there might be a node closer then in the first 2000s.
Any ideas?
The dataset is in dataverse btw.
Solved! Go to Solution.
HI @Hnl ,
If you have under 4,000 items, you can try this
With(
{
wLow:
Sort(
YourList
ID
),
wHigh:
Sort(
YourList,
ID,
Descending
)
},
ClearCollect(
colWhatever,
wLow,
Filter(
wHigh,
!(ID in wLow.ID)
)
)
)
then the Items of the gallery
Sort(
AddColumns(
colWhatever,
"Distance",
With(
{
wLat1: YourLatitudeField,
wLat2: Location.Latitude,
wLong1: YourLognitudeField,
wLong2: Location.Longitude,
wCalc: 0.0174532925199432
},
12742 * Asin(Sqrt(0.5 - Cos((wLat1 - wLat2) * wCalc)/2 +
Cos(wLat1 * wCalc) * Cos(wLat2 * wCalc) * (1 - Cos((wLong1 - wLong2) * wCalc)) / 2))
)
),
Distance
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Thanks you for the help. I am now trying your solution, but "colWhatever" collection does get the amount of rows correct, but none of the values are there. Every column is blank. I think it has to do with the first bit of code. Do you see any faults in it?
Oh nvm I got it now. Thank you!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
196 | |
52 | |
41 | |
39 | |
35 |
User | Count |
---|---|
261 | |
85 | |
71 | |
69 | |
66 |