Rename The Columns In A Collection

Input collection: myInventory34

IDNameQuantity
1001Desktop PC10
1002Monitor23
1003Laptop16


Output collection: myInventory34a (rename ‘Quantity’ column)

IDNameOnHand
1001Desktop PC10
1002Monitor23
1003Laptop16


Solution code:

//Create a collection
ClearCollect(myInventory34,
{ID:1001, Name: "Desktop PC", Quantity: 10},
{ID:1002, Name: "Monitor", Quantity: 23},
{ID:1003, Name: "Laptop", Quantity: 16}
);

//Change the column name code
ClearCollect(
    mySolution34a,
    RenameColumns(myInventory34,"Quantity","OnHand"
    )
);


Output collection: myInventory34b (rename ‘Name’ & ‘Quantity’ columns)

IDProductOnHand
1001Desktop PC10
1002Monitor23
1003Laptop16


Solution code:

//Create a collection
ClearCollect(myInventory34,
{ID:1001, Name: "Desktop PC", Quantity: 10},
{ID:1002, Name: "Monitor", Quantity: 23},
{ID:1003, Name: "Laptop", Quantity: 16}
);

//Change multiple column names code
ClearCollect(
    mySolution34b,
    RenameColumns(myInventory34,"Name","Product","Quantity","OnHand")
);