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

(0) ShareShare
ReportReport
Posted on by 329

Good day to you all. My goal for this part of my application is for a user to file a report that lists all items that are either in the Safe or a Work Bag. The report is then generated, and then sent via email to a distribution group. The report has the following criteria:

 

1. A list of all items, by serial number and item type. 

2. Total amount of items in both locations.

3. Date and time of the report. 

 

 

So far, I've been able to filter this data, via three seperate dropdowns,  in a gallery or a datatable with no issues.  However, now I need to take the data from the gallery and then send it in an email. Emailing in PowerApps has been covered in a few threads already. I know that the best way to do this is have the data put into a Collection and then email it. 

 

How can I pull specific parts of data (namely text) and then store them into a collection? Is that possible?

 

 

v/r

Brendon

Categories:
  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @BrendonBrooksP1,

     

    If the Gallery data is what you would like to save in a collection, then you could take use of clearcollect () function to save it into a collection, for example:

    Clearcollect(CollectionNeeded, Gallery1.AllItems)

    Besides, if you only want to keep special column, then we could dropdown the other columns with the Dropcolumns function:

    "

    DropColumns( Table, ColumnName1 [, ColumnName2, ... ] )

    • Table - Required. Table to operate on.
    • ColumnName(s) - Required. Name(s) of the column(s) to drop. You must specify a string (for example, "Name" with double quotes included) for this argument.

    "

    Function reference:

    AddColumns, DropColumns, RenameColumns, and ShowColumns function in PowerApps

    Collect, Clear, and ClearCollect functions in PowerApps

     

    Regards,

    Michael

  • jwademcg Profile Picture
    8 on at

    If you want only specific columns, just figured that out.  You nest the ShowColumns function within the ClearCollect

     

    Clearcollect(CollectionNeeded, ShowColumns(Gallery1.AllItems,"ColumnName1","ColumnName2","ColumnName3","etc..."))

     

    The column names must be in quotes.

  • wayneb Profile Picture
    4 on at

    This helped me so much! I was over complicating what I was trying to do!

  • Sajarac Profile Picture
    3,295 on at

    @jwademcg , Hi there, quick question for this specific point:

     

    Clearcollect(CollectionNeeded, ShowColumns(Gallery1.AllItems,"ColumnName1","ColumnName2","ColumnName3","etc..."))

    If I have values in my collection plus values form different list how Can I include those values in the newly created collection?

     

    The reason why I am asking you is because if I include those labels into my collection then my flow fails.

     

    Capture.PNG

     

    Thank you very much.

  • GauravJain Profile Picture
    3 on at

    I am Also having the same issue . Any lead would be a great help .

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Same issue here... 😞 Any hints?

  • Sajarac Profile Picture
    3,295 on at

    I have created first a single collection with all the required fields and making sure that  I am pointing the values not tables as described in the picture above. Once is fine I have added the second collection same procedure, and the last step was to create a third collection combining collection1 and collection 2

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Sounds good! Could you please give us a code sample? 

  • Sajarac Profile Picture
    3,295 on at

    Sure, I will send you something later today. I am currently away from my pc

  • Sajarac Profile Picture
    3,295 on at

    Hi @Anonymous , this is what I have:

    I am collecting different values from 2 galleries plus some individual values (var) using this:

     

    ClearCollect(
    QuoteHeader,
    {
    Customer: varCustomerName,
    Region: varCustomerState,
    Quote: varSAPNumber,
    Freight: Value(NQTextInputFreight.Text),
    Contact: varContactName,
    Created: Today()
    }
    );
    ClearCollect(
    QuoteGallery1,
    ForAll(
    GalleryDatabase.AllItems,
    {
    Name: GDBuildingName.Text,
    Item: GDBidItem.Text,
    Title: GDLblDescription.Text,
    UoM: GDUoM.Text,
    Price: GDTextInputPrice.Text,
    Quantity: Value(GDTextInputQty.Text)
    }
    )
    );
    ClearCollect(
    QuoteGallery2,
    ForAll(
    GalleryDatabase2.AllItems,
    {
    Name2: GDBuildingName_1.Text,
    Item2: GDBidItem_1.Text,
    Title2: GDLblDescription_1.Text,
    UoM2: GDUoM_2.Text,
    Price2: GDTextInputPrice_2.Text,
    Quantity2: Value(GDTextInputQty_2.Text)
    }
    )
    );
    ClearCollect(
    Submission,
    {
    Header: QuoteHeader,
    AEPAQuote1: QuoteGallery1,
    AEPAQuote2: QuoteGallery2
    }
    );

     

    For individual values I am colleting "Quote Header"

    Two galleries I am collecting QuoteGalley1 and QuoteGallery2

    And for the final submission I am collecting "Submission" that is the value that I am passing to my flow as a JSON.

     

    I hope this helps.

     

    Regards.

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

#2
WarrenBelz Profile Picture

WarrenBelz 191 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 167

Last 30 days Overall leaderboard