Skip to content

Power Apps

Get The First Rows Of A Collection

Get The First Rows Of A Collection Input collection: myCars12 Year Make Model 2016 Toyota Corolla 2014 Honda Civic 2019 Toyota Camry 2018 Honda Civic 2018 Hy...

Matthew Devaney
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-first-rows-of-a-collection/. Author: Matthew Devaney.

Get The First Rows Of A Collection Input collection: myCars12 Year Make Model 2016 Toyota Corolla 2014 Honda Civic 2019 Toyota Camry 2018 Honda Civic 2018 Hyundai Elantra 2020 Honda Accord Output collection: mySolution12a Year Make Model 2016 Toyota Corolla Solution code: //Create a collection

ClearCollect(myCars12, { 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 first row only code

ClearCollect( mySolution12a, First(myCars12) ); Code language: JavaScript ( javascript ) Output collection: mySolution12b Year Make Model 2016 Toyota Corolla 2014 Honda Civic 2019 Toyota Camry Solution code: //Create a collection

ClearCollect(myCars12, { 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 first rows code

ClearCollect( mySolution12b, FirstN(myCars12, 3 ) ); Code language: JavaScript ( javascript )

Share this

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.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →