cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cjberr89
Level: Powered On

Reference a field in a gallery item into a collection

Have looked for an answer, but cannot find one in either here or the documentation.

 

I have 2 galleries (different filters of a sharepoint list) both restricted to 5 items each.  the gallery shows the title of the item, a date label and I have added a dropdown (not available in the original SP list).

 

I am looking to fill a seperate collection with the combined outputs of each gallery item (in each gallery and some non-gallery fields) so it would look something like this:

 

Milestone_1_Title | Milestone_1_Duedate | Milestone_1_Dropdown | Milestone_2_Title | Milestone_2_Duedate etc.

 

I cannot find anywhere that talks through how to reference indvidual elements within a gallery (the dropdown.selectedtext for example).

 

Any help would be much apreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Reference a field in a gallery item into a collection

Hi @cjberr89 ,

Could you please share a bit more about your scenario?

Do you want to combine each item (5 items in total) in first Gallery with corresponding item in second Gallery, then save it into a collection?

 

I have made a test on my side, please take a take a try with the following workaround:

Set the OnSelect property of the "Combine" button to following:

 

Clear(MergedCollection);
ForAll( FirstN([1,2,3,4,5,6,7,8,9,10], CountRows(FirstGallery.AllItems)), Collect( MergedCollection, { Milestone_1_TitleColumn: Last(FistN(FirstGallery.AllItems, Value)).Milestone_1_Title.Text,
Milestone_1_DuedateColumn: Last(FistN(FirstGallery.AllItems, Value)).Milestone_1_Duedate.Text,
Milestone_1_DropdownColumn: Last(FistN(FirstGallery.AllItems, Value)).Milestone_1_Dropdown.Selected.Value,
Milestone_2_TitleColumn: Last(FistN(SecondGallery.AllItems, Value)).Milestone_2_Title.Text,
Milestone_2_DuedateColumn: Last(FistN(SecondGallery.AllItems, Value)).Milestone_2_Duedate.Text,
Milestone_2_DropdownColumn: Last(FistN(SecondGallery.AllItems, Value)).Milestone_2_Dropdown.Selected.Value } ) )

Note: I assume that the Milestone_1_Title, Milestone_1_Duedate are Label controls in your First Gallery, the Milestone_1_Dropdown is a Dropdown in your First Gallery.  The Milestone_2_Title, Milestone_2_Duedate are Label controls in your Second Gallery, the Milestone_2_Dropdown is a Dropdown in your Second Gallery.

 

After you press the above "Combine" button, the merged outputs would be populated into the MergedCollection.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Reference a field in a gallery item into a collection

Hi @cjberr89 ,

Could you please share a bit more about your scenario?

Do you want to combine each item (5 items in total) in first Gallery with corresponding item in second Gallery, then save it into a collection?

 

I have made a test on my side, please take a take a try with the following workaround:

Set the OnSelect property of the "Combine" button to following:

 

Clear(MergedCollection);
ForAll( FirstN([1,2,3,4,5,6,7,8,9,10], CountRows(FirstGallery.AllItems)), Collect( MergedCollection, { Milestone_1_TitleColumn: Last(FistN(FirstGallery.AllItems, Value)).Milestone_1_Title.Text,
Milestone_1_DuedateColumn: Last(FistN(FirstGallery.AllItems, Value)).Milestone_1_Duedate.Text,
Milestone_1_DropdownColumn: Last(FistN(FirstGallery.AllItems, Value)).Milestone_1_Dropdown.Selected.Value,
Milestone_2_TitleColumn: Last(FistN(SecondGallery.AllItems, Value)).Milestone_2_Title.Text,
Milestone_2_DuedateColumn: Last(FistN(SecondGallery.AllItems, Value)).Milestone_2_Duedate.Text,
Milestone_2_DropdownColumn: Last(FistN(SecondGallery.AllItems, Value)).Milestone_2_Dropdown.Selected.Value } ) )

Note: I assume that the Milestone_1_Title, Milestone_1_Duedate are Label controls in your First Gallery, the Milestone_1_Dropdown is a Dropdown in your First Gallery.  The Milestone_2_Title, Milestone_2_Duedate are Label controls in your Second Gallery, the Milestone_2_Dropdown is a Dropdown in your Second Gallery.

 

After you press the above "Combine" button, the merged outputs would be populated into the MergedCollection.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

cjberr89
Level: Powered On

Re: Reference a field in a gallery item into a collection

Thanks @v-xida-msft ,

 

Used your method to create a combined collection, then used the Last(FirstN(...., 1), Last(FirstN(...., 2) to bring everything onto one row.

 

Thanks

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,061)