web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding Gallery data to...
Power Apps
Answered

Adding Gallery data to a Collection using a Button inside a Gallery

(0) ShareShare
ReportReport
Posted on by 311

I have found similar questions and responses to my question - but none are quite the same as my specific issue:

I have over 400 quiz questions and multiple choice answers in a Gallery based on a Dataverse Table. The Gallery includes the navigation chevron to move between questions - but it does not use a method to 'Select' the current record on display. I need to capture 3 items of data when the user presses a button which has been inserted into the Gallery (for clarity: the Button is within the Gallery on the Screen):

 

Select(Parent);
Collect(
Results,
{
Category: ThisItem.Category,
Name: ThisItem.Name,
Response: Response.Selected.Value
}
)

 

This however does not actually collect any details for my Results Collection. Perhaps it is a syntax issue or I am maybe approaching this wrong? It's quite frustrating because I know that this really is a simple piece of code that just isn't doing it's job!

 

Thanks for any tips or suggestions,

Adam

Categories:
  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @AdamGill1965 ,

     

    As you said that there's a button inside gallery for each row, then this would be the formula you want:

    OnSelect on the button

    Collect(
     colResults,
     {
     Category: ThisItem.Category,
     Name: ThisItem.Name,
     Response: Response.Selected.Value
     }
    );

     

    That's it!

    Select() operation is used when you have some code in your Parent's OnSelect which is your Gallery in this case.

    Then the button would have invoked the Gallery's OnSelect function.

     

    Hope this helps

  • AdamGill1965 Profile Picture
    311 on at

    Thanks - sadly, removing the "Select(Parent);" element did nothing. I am still only capturing the 1 of the 3 data items into my Collection. That is part of my frustration - this should work - but it simply doesn't. It is capturing the Response - but that is in a DropDown box element inside the Gallery - the first 2 items of data are not being captured. For clarity, I am now using the following formula in the OnSelect property of a Button inside the Gallery:

    Collect(
    Results,
    {
    Category: ThisItem.Category,
    Name: ThisItem.Name,
    Response: Response.Selected.Value
    }
    )

     

    My thought is this may be because I am not implicitly selecting the Gallery record - and I am unsure how to do that, given I do not have a "Select" function as part of the navigation between records - that is why I tried to add the "Select(Parent)" element.

     

    I really just think that I need some way to ensure that the Gallery record on display is also implicitly "Select"ed in some way, for this to work - I'm just not sure of how to achieve that.

     

    Thanks,

    Adam

  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @AdamGill1965 ,

     

    For your question: "My thought is this may be because I am not implicitly selecting the Gallery record - and I am unsure how to do that"

     

    You don't need to, since if there's any control you click then it will always understand which record is selected.

    If that didn't help you, you can try another method.

     

    Collect(
     Results,
     {
     Category: Gallery1.Selected.Category,
     Name: Gallery1.Selected.Name,
     Response: Response.Selected.Value
     }
    )

     

    Replace with your gallery name

     

    Let me know if this works.

    Hope this helps

  • AdamGill1965 Profile Picture
    311 on at

    Thanks so much for your attention on this. That also does not work - it is still only capturing the Value in my DropDown box.

  • AdamGill1965 Profile Picture
    311 on at

    Thanks so much for your attention on this. That also does not work - it is still only capturing the Value in my DropDown box.

  • AdamGill1965 Profile Picture
    311 on at

    Update: I added some Text Labels inside my Gallery, to categorically prove that there are valid Values available for my Collection update - and there are. So, I tried this approach:

     

    Collect(
    Results,
    {
    Category: CategoryLabel.Text,
    QuestionID: QuestionIDLabel.Text,
    Response: Response.SelectedText.Value
    }
    )

     

    So now I have confirmed that all of the elements contain data - but still the Collect command associated with the OnSelect of the Button is doing nothing(!)

     

    This is really quite frustrating... does anyone have any other insights, please?

    Thanks,
    Adam

  • Verified answer
    AdamGill1965 Profile Picture
    311 on at

    And today, without changing a darn thing, this now works. Highly illogical.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard