Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Collect items from gallery containing dropdown control

Posted on by 36

Hello, 

 

I have a gallery that's created from a collection (Items property is set to a collection called c_approvers). However, I added a dropdown to the Gallery and set its Items to: Filter(Users, Role=ThisItem.appr_role), where Users is another table that contains two columns: Role, and Username. The idea here is to show the different usernames in the dropdown that have the same Role. I'm able to see the names of users when running the app. 

 

Problem: 

I created a button to collect the details of the gallery to another collection (myCollection) and used the following:  

 

Clear(myCollection);
ForAll(
Gallery.AllItems As item,
Collect(myCollection, {Index : item.Label33.Text, Approver: Dropdown5.Selected}
));

 

When I check the result I get the following: 

 

Approver          Index

[Record]           1

[Record]           2

[Record]           3

 

 

I need to get the name of the approver, not a record. Your advice is appreciated! thanks. 

 

 

  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 142,651 on at
    Re: Collect items from gallery containing dropdown control

    @OmarSaleh ,

    If the dropdown is in the gallery, you just need to add Item. to the front as in the line above.

  • OmarSaleh Profile Picture
    OmarSaleh 36 on at
    Re: Collect items from gallery containing dropdown control

    @WarrenBelz , I think the name is repeated because this below statement is getting the name of the last clicked-on record in the Gallery.

    Dropdown5.Selected.ApproverName

     

    Look at the screenshot here, because Asif was the last name I selected, the record is highlighted and the name is repeated in the output collection. 

    OmarSaleh_0-1703381013349.png

  • OmarSaleh Profile Picture
    OmarSaleh 36 on at
    Re: Collect items from gallery containing dropdown control

    @WarrenBelz, I just changed the column name in the table from (Approver) to (ApproverName) to avoid confusion and tried to add it here: 

    Approver: Dropdown5.Selected.ApproverName

     

    But the collection now shows the same name repeated in all records although different names were selected for indexes 1 and 3. 

     

    1  Asif

    2  Asif

    3  Asif 

     

     

  • OmarSaleh Profile Picture
    OmarSaleh 36 on at
    Re: Collect items from gallery containing dropdown control

    Thanks, @WarrenBelz for your response. Approver is not a Person field, it's a text (name) from a table that has the following columns: ID - Approver - Email - Role. There might be multiple approvers (names) having the same role, so the dropdown is added to select the relevant approver for the app user.
    The collection that's used to build the Gallery has only Index and Roles details. Hope this makes it clear to you. Please let me know if you need further explanation. 

  • WarrenBelz Profile Picture
    WarrenBelz 142,651 on at
    Re: Collect items from gallery containing dropdown control

    Hi @OmarSaleh ,
    Assuming Approver is a Person Field

    Clear(myCollection);
    ForAll(
     Gallery.AllItems As item,
     Collect(
     myCollection, 
     {
     Index : item.Label33.Text, 
     Approver: Dropdown5.Selected.DisplayName
     }
     )
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,651

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,727

Leaderboard