Replace A Whole Row In A Collection

Input collection: myTrucks42

SerialYearMake Model
93942020FordF150
59782018ChevySilverado
12352016GMYukon


Output collection: mySolution42 (replace row with Serial ‘5978’)

SerialYearMake Model
93942020FordF150
30402019DodgeRam
12352016GMYukon


Solution code:

//Create a collection
ClearCollect(myTrucks42,
{Serial: 9394, Year: 2020, Make: "Ford", Model: "F150"},
{Serial: 5978, Year: 2018, Make: "Chevy", Model: "Silverado"},
{Serial: 1235, Year: 2016, Make: "GM", Model: "Yukon"}
);

//Replace a row code
ClearCollect(mySolution42, myTrucks42);
Set(myNewTruck42,{Serial: 3040, Year: 2019, Make: "Dodge", Model: "Ram"});
Update(mySolution42,LookUp(mySolution42,Serial=5978),myNewTruck42);