I want to combine two collections into one. So n the new collection (colCombined) , for every entry in colA I want a row from colB and the fields of colB tagged on and included so for example in colA I have 4 rows with 3 columns column1 column2 column3
and in ColB I have 2 columns and 3 rows
ColA
| Column1A |
Column2A |
Colum3A |
| Blue |
Round |
Here |
| Red |
square |
There |
| Green |
Triangle |
everywhere |
| Yellow |
Round |
there |
ColB
| Column1B |
Column2B |
| Yesterday |
1 |
| Today |
2 |
| Tomorrow |
3 |
I want the new colCombined to look like this
| ColComb1 |
ColComb2 |
ColComb3 |
ColComb4 |
ColComb5 |
| Blue |
Red |
Here |
Yesterday |
1 |
| Blue |
Red |
Here |
Today |
2 |
| Blue |
Red |
Here |
Tomorrow |
3 |
| Red |
Square |
There |
Yesterday |
1 |
| Red |
Square |
There |
Today |
2 |
| Red |
Square |
There |
Tomorrow |
3 |
| etc |
etc |
|
|
|
This is the code I have and it works.. however it creates a nested collection and I have to click on each row to view the details in the collection and so therefore I can't either use it in a gallery or patch it easily to a list which is what I want to do. How do I make the collection flat?
ClearCollect(
colCombined,
ForAll(
colA,
ForAll(
colB,
{
CombinedField1:colAfield1,
CombinedField2:colAfield2,
CombinedField3:colAfield3
CombinedField4:colBfield1,
CombinedField5:colBfield2,
}
))
)
Hoping you can help !
If it's more efficient to patch the combination of the 2 collections straight to the sharepoint list rather than this middle step of creating a collection I'm happy to do that. There is one people field amongst the fields so that just needs to be taken into account when patching
Thanks
TIA