Filter A Collection With AND Condition

Input collection: myTrucks40

YearMake Model
2020FordF150
2018ChevySilverado
2019FordF150
2020ChevyAvalanche
2017ChevySilverado
2016GMYukon


Output collection: mySolution40 (filter on greater than or equal to year ‘2018’ AND less than or equal to year ‘2020’)

YearMake Model
2020FordF150
2018ChevySilverado
2019FordF150
2020ChevyAvalanche


Solution code:

//Create a collection
ClearCollect(myTrucks40,
{Year: 2020, Make: "Ford", Model: "F150"},
{Year: 2018, Make: "Chevy", Model: "Silverado" },
{Year: 2019, Make: "Ford", Model: "F150" },
{Year: 2020, Make: "Chevy",Model: "Avalanche"},
{Year: 2017, Make: "Chevy", Model: "Silverado"},
{Year: 2016, Make: "GM", Model: "Yukon"}
);

//Filter collection code
ClearCollect(
    mySolution40,
    Filter(myTrucks40,Year>=2018,Year<=2020)
);