Insert A New Row Into A Collection

Input collection: myTestScores31a

FullNameAge TestScore
David Jones3278
Anne Lisbon4592
Penlope Parra2656


Input record: myTestScores31b

FullNameAge TestScore
Harold Reimer5065


Output collection: mySolution31

FullNameAge TestScore
David Jones3278
Anne Lisbon4592
Penlope Parra2656
Harold Reimer5065


Solution code:

//Create a collection
ClearCollect(myTestScores31a,
{FullName:"David Jones", Age: 32, TestScore: 78},
{FullName:"Anne Lisbon", Age: 45, TestScore: 92},
{FullName:"Penelope Parra", Age: 26, TestScore: 56}
);

//Create a Row
Set(
    myTestScores31b,
    {FullName:"Harold Reimer", Age: 50, TestScore: 65}
);

//Insert a new row into collection code
ClearCollect(mySolution31,myTestScores31a);
Collect(mySolution31,myTestScores31b);

//Alternate solution
ClearCollect(mySolution31,myTestScores31a);
Patch(
    mySolution31,
    Defaults(mySolution31),
    {FullName:"Harold Reimer", Age: 50, TestScore: 65}
)