Hello,
I am having trouble grabbing the data from a nested gallery and saving it to a collection.
I have a vertical gallery (Gallery1) and nested inside Gallery1 is a horizontal gallery (Gallery2). The data source for Gallery1 is a Sharepoint list and the datasource for Gallery2 is the attachments list for each item in Gallery1. Each item in Gallery1 can have any number of attachments.
Gallery2 displays the image and it's display name. I want to be able to save the all the images and display names for each attachments list for each item displayed in Gallery1.
I have a button when selected is supposed to collect the data and save it to a collection. The following is the code.
Clear(imageCollection);
Collect(imageCollection,
ForAll(Gallery1.AllItems,
{
DataStream: Image.Image,
Name: fileName.Text
}
)
);
Which gives me the following Collection:
I have tried a number of different formulas with no success. Please steer me in the right direction
Thanks, you gave me something to chew on
Well, the main point of my response was that your gallery has the data. So duplicating into a collection is just that..a duplication.
In other words:
ClearCollect(someCollection, <theFormulaIprovided>);
someFlow.Run(JSON(someCollection))
This would be duplicating the data to then convert to JSON.
Whereas:
someFlow.Run(JSON(<theFormulaIprovided>))
Is equivalent and does not duplicate unnecessarily.
Thank you Randy, that did the trick.
Ultimately I want to send out an email with the all the data from Gallery1 including all of the attachments. I have a Flow that accepts a JSON and then compiles the JSON into an email. I wasn't sure how to nest the attachments into a Collection to send out as a JSON.
I wanted to split the data into 2 collections, 1 with strings and second with the image data. Perhaps there is a more elegant way to accomplish this.
Your gallery already contains all of your data!! Putting it in a collection is just duplicating the data you already have.
But if there is some particular reason to duplicate it, then please consider changing your Formula to the following:
ClearCollect(imageCollection,
Ungroup(
ForAll(Gallery1.AllItems,
ForAll(Gallery2.AllItems,
{DataStream: Image.Image,
Name: fileName.Text
}
)
),
"Value"
)
);
There is one caveat to this...nested galleries (Gallery2) do not naturally give up their AllItems tables. You need to force the primary gallery to invoke data from the nested gallery. To do this, place a label in your parent gallery and set the Text property to: CountRows(Gallery2.AllItems)
You can make the label hidden...it just needs to exist to "invoke" the reveal of the gallery. That formula does not have to be based on AllItems, it can reference anything in the gallery, but I find the above simple enough.
I hope this is helpful for you.
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
mmbr1606
275
Super User 2025 Season 1