Input collection: myCars21
Year | Make | Model |
2016 | Toyota | Corolla |
2014 | Honda | Civic |
2019 | Toyota | Camry |
2018 | Honda | Civic |
2018 | Hyundai | Elantra |
2020 | Honda | Accord |
Output collection: mySolution21a
Year | Make | Model |
2019 | Toyota | Camry |
Solution code:
//Create a collection
ClearCollect(myCars21,
{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 middle row code
ClearCollect(
mySolution21a,
Last(FirstN(myCars21,3))
);
Output collection: mySolution21b
Year | Make | Model |
2019 | Toyota | Camry |
2018 | Honda | Civic |
2018 | Hyundai | Elantra |
Solution code:
//Create a collection
ClearCollect(myCars21,
{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 middle rows code
ClearCollect(
mySolution21b,
LastN(FirstN(myCars21,5),3)
);