Input collection: myInventory33
ID | Name | Quantity |
1001 | Desktop PC | 10 |
1002 | Monitor | 23 |
1003 | Laptop | 16 |
Output collection: mySolution33a (update ‘Monitor’ quantity to 18)
ID | Name | Quantity |
1001 | Desktop PC | 10 |
1002 | Monitor | 18 |
1003 | Laptop | 16 |
Solution code:
//Create a collection
ClearCollect(myInventory33,
{ID:1001, Name: "Desktop PC", Quantity: 10},
{ID:1002, Name: "Monitor", Quantity: 23},
{ID:1003, Name: "Laptop", Quantity: 16}
);
//Change the value in a cell code
ClearCollect(mySolution33a,myInventory33);
Patch(mySolution33a,LookUp(mySolution33a,ID=1002),{Quantity: 18});
Output collection: mySolution33b (update multiple values for ID 1003)
ID | Name | Quantity |
1001 | Desktop PC | 10 |
1002 | Monitor | 23 |
1003 | Surface Laptop | 33 |
Solution code:
//Create a collection
ClearCollect(myInventory33,
{ID:1001, Name: "Desktop PC", Quantity: 10},
{ID:1002, Name: "Monitor", Quantity: 23},
{ID:1003, Name: "Laptop", Quantity: 16}
);
//Change multiple values in a row code
ClearCollect(mySolution33b,myInventory33);
Patch(
mySolution33b,
LookUp(mySolution33b,ID=1003),
{Name: "Surface Laptop", Quantity: 33}
)