Input collection: myInventory34
ID | Name | Quantity |
1001 | Desktop PC | 10 |
1002 | Monitor | 23 |
1003 | Laptop | 16 |
Output collection: myInventory34a (rename ‘Quantity’ column)
ID | Name | OnHand |
1001 | Desktop PC | 10 |
1002 | Monitor | 23 |
1003 | Laptop | 16 |
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)
ID | Product | OnHand |
1001 | Desktop PC | 10 |
1002 | Monitor | 23 |
1003 | Laptop | 16 |
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")
);