cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cjberr89
Frequent Visitor

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
v-xida-msft
Community Support
Community Support

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
v-xida-msft
Community Support
Community Support

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.

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,963)