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 / Reading data from a Ga...
Power Apps
Answered

Reading data from a Galley

(0) ShareShare
ReportReport
Posted on by 5

I have an app where I have a Gallery that reads data from a Sharepoint List. This gallery filters the information with the text the user input una textbox.  Thats ok.

 

Now I need to add a button that reads all the items displayed in the gallery to make a long text with several other chains of text to display the user and copy to the clipboard.

 

How can I read the value of the labels in each item of the gallery and mix with the other text???

Categories:
  • aka271 Profile Picture
    78 on at

    You can get AllItems of a Galleryby just simply refering to the Gallery like that:

    Gallery.AllItems
  • Tristan_D Profile Picture
    405 on at

    Hi @Eduard99 ,

     

    I don't think I understand what you try to do there ^^. You want to concatenate all the data from each item into one text ?

    To do that, you can use a concatenate.... not sure if it is what you try to obtain though ^^

     

    T

  • Eduard99 Profile Picture
    5 on at

    Thank you for your replies and excuse me for the bad explanation.

     

    Yes, @Tristan_D , I need to get the data from the gallery and make a kind of report mixing it with external conclusions and explanations about the data selected.

     

    I've tried using : ForAll(Gallery1.AllItems; 

    Collect(myCollection; {FieldA:DATA1; FieldB:DATA2})
    );

     

    This works, but what I need es to read the datafields into a var. Something like this:

     

    ForAll(Gallery1.AllItems; 

       Set( myVar;

          myVar & " Some text " & myCollection["@FieldA"] & "other text" & myCollection["@FieldB"] & Char(13))

    );

     

    The problem here is thar the function Set is not allowed inside a ForAll loop.

     

     

     

  • Verified answer
    Tristan_D Profile Picture
    405 on at

    Hi @Eduard99 ,

    Thanks for the clarifications 😉 !

    Indeed, you can't Set a varaible in a loop though,  you can achieve similar functionality by using other functions such as Collect, UpdateContext, or Concatenate within the ForAll loop.


    Could something like that works for you ?

    ClearCollect(
    myCollection,
    Gallery1.AllItems
    );

    ClearCollect(
    myVarCollection,
    ForAll(
    myCollection,
    Concatenate(
    "Some text ",
    ThisItem.FieldA,
    " other text ",
    ThisItem.FieldB,
    Char(13) // This adds a line break after each concatenation
    )
    )
    );


    T

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 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard