Input collection: mySales3
| ProductID | QuantitySold |
| 1001 | 4 |
| 1002 | 5 |
| 1001 | 7 |
| 1000 | 1 |
| 1000 | 8 |
Input collection: myProduct3
| ProductID | ProductName |
| 1000 | Jacket |
| 1001 | T-Shirt |
| 1002 | Baseball Cap |
Output collection: mySolution3
| ProductID | ProductName | QuantitySold |
| 1001 | T-Shirt | 4 |
| 1002 | Baseball Cap | 5 |
| 1001 | T-Shirt | 7 |
| 1000 | Jacket | 1 |
| 1000 | Jacket | 8 |
Solution code:
//Create two collections
ClearCollect(myProduct3,
{ProductID: "1000", ProductName: "Jacket"},
{ProductID: "1001", ProductName: "T-Shirt"},
{ProductID: "1002", ProductName: "Baseball Cap"}
);
ClearCollect(mySales3,
{ProductID: "1001", QuantitySold: 4},
{ProductID: "1002", QuantitySold: 5},
{ProductID: "1001", QuantitySold: 7},
{ProductID: "1000", QuantitySold: 1},
{ProductID: "1000", QuantitySold: 8}
);
//Add a column from another table code
ClearCollect(mySolution3,
AddColumns(mySales3,"ProductName",LookUp(myProduct3,ProductID=myProduct3[@ProductID],ProductName))
);