cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BrendonBrooksP1
Post Patron
Post Patron

Adding Gallery Data to a Collection

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

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

14 REPLIES 14
v-micsh-msft
Community Support
Community Support

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jwademcg
Regular Visitor

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
Frequent Visitor

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

@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.

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

JanaH
Frequent Visitor

Same issue here... 😞 Any hints?

sajarac
Super User
Super User

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

JanaH
Frequent Visitor

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

sajarac
Super User
Super User

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (5,123)