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 / Gallery to display ite...
Power Apps
Answered

Gallery to display items from secondary SharePoint List

(0) ShareShare
ReportReport
Posted on by 49

Hello everyone,

I´m currently working on the following project but haven´t been able to figure it out so I´m hoping somebody can help.

I have a SharePoint list custom form connected to a Main list (NC), one of the app´s screens have a gallery that, in turn, is pulling data out of a secondary list called "Acciones" (Actions in English). 

 

The same screen allows to create records (+) and store them on the above mentioned secondary list so that when the user clicks on "Details" from the gallery, it should show the appropiate record. The gallery works fine but the issue is when attempting to display the correct item after clicking on "details".

 

The list´s colums look as follows:

 

Main List (NC):

Code (Primary)DescriptionClassStatus

 

Secondary list (Acciones/Actions):

Action #DetailsOrigen (Code)Owner

 

The "items" propery of the Gallery is using: 

 

Filter(Acciones,DataCardValue_Cod.Text=Origen)

 

On the Formscreen for the "Details" form I´m using: 

 

LookUp(Acciones,'Asignación #'=GalleryListAcciones.Selected.'Asignacion#'.Text)

 

Where:

  • Acciones: Name of secondary list
  • Action #: Column name from the secondary list
  • Action# (no spaces): Name of the corresponding label on the gallery

The problem I have is that even though I´m able to create and store records on the secondary list just fine, if there are 2 records with the same "Action #" the app is showing only the first one not considering the Code, so if for example I have the following data stored:

 

Main List (NC):

Code (Primary)DescriptionClassStatus
001-2024Test 1Test 1Opened
002-2024Test 2Test 2Closed

 

Secondary list (Acciones/Actions): 

Action #DetailsOrigen (Code)Owner
1Action 1001-2024Me
2Action 2001-2024Boss
1Action 2002-2024Me

 

In this case if I´m viewing the NC: 002-2024 and clic on details for Action #1 is pulling the data for Action 1 but NC 001-2024 (the first on the secondary list) where it should take me to the first action but of 002-2024.

 

I also tried with filter:

Filter(Prorrogas As _Prorrogas,

    LookUp(Acciones,'Action #'=GalleryListAcciones.Selected.'Action#'.Text) && LookUp(Acciones,'Origen'=GalleryListAcciones.Selected.'Origen'.Text))

)

 

But to no avail. I´ve even attempted fixing it using collections: 

 

LookUp(colAcciones,GalleryListAcciones.Selected.'Action#'.Text='Action #')

 

But if I do, the details form gets stuck on "Obtaining data". 😞

 

I hope this makes sense to you.

Thanks in advance for your help.

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,833 Super User 2026 Season 2 on at

    Hi @AlexBS ,

     

    The LookUp function works in such a way that it will return the first item it finds that meets the conditions and then stops looking further, which is exactly what is happening in your case. Simply replacing the LookUp function with a Filter function will not work either since that returns a table, whereas the Form control expects a single record.

     

    In case you wish to always get the details of the last action, you can simply use a combination of the Filter and Last functions:

    Last(Filter)(Acciones,'Asignación #'=GalleryListAcciones.Selected.'Asignacion#'.Text))

     

    In case you want the user to be able to see all actions and then select one to display in the form, you'll have to add a second gallery to show all actions that meet the filter conditions and then let the user select the action they want to see in the form.

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    @AlexBS ,

    Just adding a thought to avoid any potential Delegation issue

    LookUp(
     Sort(
     Acciones,
     'Origen',
     SortOrder.Descending
     ),
     'Action #' = GalleryListAcciones.Selected.'Action#'.Text
    )

     

  • AlexBS Profile Picture
    49 on at

    Thanks for the response @BCBuizer , unfortunately yes, I need to brind the spefic item´s detail noy just the last one so the "Last" filter won´t work.

     

    Something like "GalleryListAcciones.selected" that I saw on another post but weirdly it does´t work on Custom forms, only Canvas apps.

     

    Any other suggestions? 

  • AlexBS Profile Picture
    49 on at

    Thanks @WarrenBelz , I just tried your solution but unfortunately it´s pulling the last item´s details instead of the appropriate one.

     

    I´m including a couple of screenshots for your consideration, if you need more info please let me know.

     

    In the example, when clicking on Action 1 for NC-001 details, it pulls the data corresponding to Action 1 NC-005 instead which is, of course, incorrect:

     

    Gallery:

    NC-001 Gallery.pngDetails:

    NC-001 Action 1 Details (shows NC-005 Action 1 instead).png

  • BCBuizer Profile Picture
    22,833 Super User 2026 Season 2 on at

    Hi @AlexBS ,

     

    If you, in a custom SharePoint form, want to display a related record to the selected item in the SharePoint list, you can reference SharePointIntegration.Selected . This can then be used in any Filer or LookUp functiond.

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    @AlexBS ,

    I will leave you with @BCBuizer - I only posted an alternative pattern to the last item idea

  • AlexBS Profile Picture
    49 on at

    @BCBuizer you are genius! I was able to get it to, partially, work by replacing the item property of the details form with: 

     

    If(IsBlank(SharePointIntegration.Selected),First([@Acciones]),SharePointIntegration.Selected)
     
    Now Action #, Details field and Origen show the data correspoding to the appropriate item by referencing the Gallery´s label name like: 
     
    PlainText(Details.Text)
     
    However, I´m having trouble doing the same with people and dropdown columns, for instance: 
     
    On the "Owner" field on the form I´m trying to reference the "Assignee" label from the gallery but doesn´t take it.
    Same with Process where I entered "Process.text" (the name of the value) but I get the error: 
     
    "Expected Record Value.
     
    The propoerty on this controol expects record values. The rules produces TExt values which are incompatible".
     
    Any suggestions?
  • BCBuizer Profile Picture
    22,833 Super User 2026 Season 2 on at

    Hi @AlexBS ,

     

    Instead of referencing the values of the controls, reference the thing that is giving the control its' value. For instance instead of Process.Text try to use SharePointIntegration.Selected.Process.

     

    If this doesn't help, please share a screenshot of your form since I'm not sure if by "gallery" you are referring to an actual gallery control or to the SharePoint list User Interface.

  • AlexBS Profile Picture
    49 on at

    Thanks @BCBuizer that didn´t work either, neither on the "default" nor on the "defaultselecteditems" on the dropwdown field.

     

    Please find below a couple of screenshots of my Horizontal Gallery and the Gallery´s details form and let me know your thoughts:

     

    NC Gallery.pngNC GAllery Details Form 1.png

     

    On the text fields of the form I´m using "Comentario.Text" (Comments in Spanish) on the "Default" property of the field value and that brings the corresponding data however, that doesn´t seem to work on both dropdown and people fields so I´m guessing there should be another way to fetch the corresponding data.

  • BCBuizer Profile Picture
    22,833 Super User 2026 Season 2 on at

    Hi @AlexBS ,

     

    If the Gallery control from the first screenshot is connected to the same data source as the form from the second screenshot (the Acciones list), then it is probably the easiest to try to remove the datacards that are not working as expected and then add them back. 

     

    The reason for this is that the desired behaviour should be default for a form control and by making changes to it, some fields stopped working. Removing the data cards and adding them back basically removes any customisations and should therefore restore the functionality.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard