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 / Save All Gallery Items...
Power Apps
Answered

Save All Gallery Items in a Collection

(1) ShareShare
ReportReport
Posted on by 5,331 Moderator

I have an app in which the user needs the ability to take and name several site pictures.

The image gallery is below. In the test there are three images.
Phineas_0-1720038064712.png

The 'Store Collection' button has the following formula -

Collect(
    Job_Images_Collection,
    {
        DisplayName: Photo_Screen_Image_Dropdown.Selected.Value,
        Id: Photo_Screen_Image_Dropdown.Selected.Value & ".jpg",
        Value: Photo_Screen_Control.Photo,
        Image_Description: Photo_Screen_Image_Dropdown.Selected.Value,
        Invoice_Type: Photo_Screen_Invoice_Type_Fld.Text,
        Location: Photo_Screen_Location_Fld.Text,
        Title: Photo_Screen_Location_Fld.Text & " - " & Photo_Screen_Invoice_Type_Fld.Text & " - " & 
                Photo_Screen_Image_Dropdown.Selected.Value & " - " & Photo_Screen_WO_Number_Fld.Text & " - " &
                Photo_Screen_Work_Date_Fld.Text,
        Work_Date:
Photo_Screen_Work_Date_Fld.SelectedDate,
        Work_Order_Number: Photo_Screen_WO_Number_Fld.Text
       
    }
);

Clicking the button only saves the last picture taken rather than all the picture in the Gallery. There should be three entries below but there is only one. What am I missing?
Phineas_1-1720038508754.png

 


Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,974 Moderator on at

    Hi @Phineas 

     

    I only see you doing a single Collect

     

    Am I missing where you are looping and grabbing them all?

     

    I dont know exactly what but either LoopUp all the gallery.AllItems or whatever is selected filter on that or do a ClearCollect, with AllItems (too much really but possible)

     


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Phineas Profile Picture
    5,331 Moderator on at

    I tried a 'ForAll...', I got the same result - the last image created three times in the Collection.

    ClearCollect(
        Job_Images_Collection,
        ForAll(
            Photo_Screen_Gallery.AllItems,
        {
            DisplayName: Photo_Screen_Image_Dropdown.Selected.Value,
            Id: Photo_Screen_Image_Dropdown.Selected.Value & ".jpg",
            Value: Photo_Screen_Control.Photo,
            Image_Description: Photo_Screen_Image_Dropdown.Selected.Value,
            Invoice_Type: Photo_Screen_Invoice_Type_Fld.Text,
            Location: Photo_Screen_Location_Fld.Text,
            Title: Photo_Screen_Location_Fld.Text & " - " & Photo_Screen_Invoice_Type_Fld.Text & " - " & Photo_Screen_Image_Dropdown.Selected.Value & " - " & Photo_Screen_WO_Number_Fld.Text & " - " & Photo_Screen_Work_Date_Fld.Text,
            Work_Date: Drop_Work_Date_DataCardValue.SelectedDate,
            Work_Order_Number: Photo_Screen_WO_Number_Fld.Text,
            Comments: Photo_Screen_Comment_Fld.Text  
        }
      )
    );

    Collection -
    Phineas_0-1720040691213.png

     


  • Michael E. Gernaey Profile Picture
    53,974 Moderator on at

    Was everything else correct? just the picture is wrong or more than that?

  • Verified answer
    Michael E. Gernaey Profile Picture
    53,974 Moderator on at

    But in your ForAll, you aren't references by ThisRecord,

    You are just putting in the control name, which is causing it to get the whatever.

     

    In your for all you still need to reference the controls by ThisRecord

     

    FLMike_0-1720042306871.png


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Phineas Profile Picture
    5,331 Moderator on at

    I did finally get the following to work - though it only allows for one picture at a time to be taken and saved to the Collection, which is fine in this scenario.

    Camera Control OnSelect -

    Collect(
        Job_Images_Collection,
        ForAll(
            Photo_Screen_Gallery.AllItems,
        {
            DisplayName: Photo_Screen_Image_Dropdown.Selected.Value,
            Id: Photo_Screen_Image_Dropdown.Selected.Value & ".jpg",
            Value: Photo_Screen_Control.Photo,
            Image_Description: Photo_Screen_Image_Dropdown.Selected.Value,
            Invoice_Type: Photo_Screen_Invoice_Type_Fld.Text,
            Location: Photo_Screen_Location_Fld.Text,
            Title: Photo_Screen_Location_Fld.Text & " - " & Photo_Screen_Invoice_Type_Fld.Text & " - " & Photo_Screen_Image_Dropdown.Selected.Value & " - " & Photo_Screen_WO_Number_Fld.Text & " - " & Photo_Screen_Work_Date_Fld.Text,
            Work_Date: Drop_Work_Date_DataCardValue.SelectedDate,
            Work_Order_Number: Photo_Screen_WO_Number_Fld.Text,
            Comments: Photo_Screen_Comment_Fld.Text  
        }
      )
    );

    Collection -
    Phineas_0-1720043561687.png

     

    What formula do I add to save the collection to the SP Library?

    This is the flow I currently have in the 'Save to SP List' button -
    UploadJobPhotosFlow.Run(Photo_Screen_Location_Fld.Text,
        Photo_Screen_Image_Dropdown.Selected.Value,
        Photo_Screen_WO_Number_Fld.Text,
        Photo_Screen_Work_Date_Fld.Text,
        Photo_Screen_Invoice_Type_Fld.Text,
        Photo_Screen_Location_Fld.Text,
        Photo_Screen_Comment_Fld.Text,
        {
            file: {
                contentBytes: Photo_Screen_Gallery_Image.Image,
                name:  Photo_Screen_Location_Fld.Text & " - " & Photo_Screen_Invoice_Type_Fld.Text & " - " & Photo_Screen_Image_Dropdown.Selected.Value & " - " & Photo_Screen_WO_Number_Fld.Text & " - " & Photo_Screen_Work_Date_Fld.Text & ".jpg"
            }
        }
    );

    Phineas_1-1720043750342.png

     


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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 490

#2
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 381

Last 30 days Overall leaderboard