Get The Last Rows Of A Collection
Get The Last Rows Of A Collection Input collection: myCars13 Year Make Model 2016 Toyota Corolla 2014 Honda Civic 2019 Toyota Camry 2018 Honda Civic 2018 Hyu...
- Published
- Reading time
- 1 min read
Before you start
Is this guide for you?
- Best entry point
- Power Apps
- Time investment
- 1 min read
Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/powerapps-collections-cookbook/get-the-last-rows-of-a-collection/. Author: Matthew Devaney.
Get The Last Rows Of A Collection Input collection: myCars13 Year Make Model 2016 Toyota Corolla 2014 Honda Civic 2019 Toyota Camry 2018 Honda Civic 2018 Hyundai Elantra 2020 Honda Accord Output collection: mySolution13a Year Make Model 2020 Honda Accord Solution code: //Create a collection
ClearCollect(myCars13, { Year : 2016 , Make : "Toyota" , Model : "Corolla" }, { Year : 2014 , Make : "Honda" , Model : "Civic" }, { Year : 2019 , Make : "Toyota" , Model : "Camry" }, { Year : 2018 , Make : "Honda" , Model : "Civic" }, { Year : 2018 , Make : "Hyundai" , Model : "Elantra" }, { Year : 2020 , Make : "Honda" , Model : "Accord" } ); //Get the last row only code
ClearCollect( mySolution13a, Last(myCars13) ); Code language: JavaScript ( javascript ) Output collection: mySolution13b Year Make Model 2018 Toyota Civic 2018 Hyundai Elantra 2020 HOnda Accord Solution code: //Create a collection
ClearCollect(myCars13, { Year : 2016 , Make : "Toyota" , Model : "Corolla" }, { Year : 2014 , Make : "Honda" , Model : "Civic" }, { Year : 2019 , Make : "Toyota" , Model : "Camry" }, { Year : 2018 , Make : "Honda" , Model : "Civic" }, { Year : 2018 , Make : "Hyundai" , Model : "Elantra" }, { Year : 2020 , Make : "Honda" , Model : "Accord" } ); //Get the last rows code
ClearCollect( mySolution13b, LastN(myCars13, 3 ) ); Code language: JavaScript ( javascript )
Tagged
Collections · Power Apps
Have a Microsoft 365 topic idea?
Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.
Keep learning Microsoft 365
Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.
Continue learning
Related tutorials
Related questions
Related comparisons
Next action