web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Assistance with Finish...
Power Apps
Suggested Answer

Assistance with Finishing Patch of Multiple Galleries to SP List

(1) ShareShare
ReportReport
Posted on by 5,325 Super User 2025 Season 2
I've been given guidance on how to patch multiple galleries with other fields.

I've followed the instructions and gotten my formula to the following, except the
end language.

Can someone help me understand what should be in this component of the
greater flow?

Component in Question -
// Now patch all to SharePoint
ForAll(
    col_ProductionUploadPatch,
    Patch(
        ZEB_Production_Dataset_List,
        Defaults(ZEB_Production_Dataset_List),
        {
            Title: ParentTitle,
            SubGalleryType: SubGalleryType,
            SubItemValue: SubItemValue
        }
    )
);

Entire Flow -
ForAll(
    PS_Gallery.AllItems,
    With(
        {
            parentTitle: ThisRecord.Title
        },
        Collect(
            col_ProductionUploadPatch,
           
            ForAll(
                PS_Tap_Gallery.AllItems,
                {
                    ParentTitle: parentTitle,
                    SubGalleryType: "PS_Tap_Gallery",
                    SubItemValue1: ThisRecord.PSTG_Tap_Number_DD.Selected.Value,
                    SubItemValue2: ThisRecord.PSTG_Tap_Time_Fld.Text,
                    SubItemValue3: ThisRecord.PSTG_SOW_Count_Fld.Text
                }
            ),
           
            ForAll(
                PS_Flux_Gallery.AllItems,
                {
                    ParentTitle: parentTitle,
                    SubGalleryType: "PS_Flux_Gallery",
                    SubItemValue1: ThisRecord.PSFG_Flux_Type_DD.Selected.Value,
                    SubItemValue2: ThisRecord.PSFG_Flux_Weight_Fld.Text
                }
            ),
           
            ForAll(
                PS_SOW_Gallery.AllItems,
                {
                    ParentTitle: parentTitle,
                    SubGalleryType: "PS_SOW_Gallery",
                    SubItemValue1: ThisRecord.PSSG_SOW_Number_DD.Selected.Value,
                    SubItemValue2: ThisRecord.PSSG_SOW_Tag_Fld.Text,
                    SubItemValue3: ThisRecord.PSSG_SOW_Weight_Fld.Text
                }
            )
        )
    )
);
 
// Now patch all to SharePoint
ForAll(
    col_ProductionUploadPatch,
    Patch(
        ZEB_Production_Dataset_List,
        Defaults(ZEB_Production_Dataset_List),
        {
            Title: ParentTitle,
            SubGalleryType: SubGalleryType,
            SubItemValue: SubItemValue
        }
    )
)
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
    Hello @Phineas
     
    I do not understand the question, its just like patching a collection see below. So I am not sure I understand what the issue is other than adding in the ThisRecord. 
     
    ForAll(
        col_ProductionUploadPatch,
        Patch(
            ZEB_Production_Dataset_List,
            Defaults(ZEB_Production_Dataset_List),
            {
                Title: ThisRecord.ParentTitle,
                SubGalleryType: ThisRecord.SubGalleryType,
                SubItemValue: ThisRecord.SubItemValue
            }
        )
    )
  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at
    The first thing you need in there is some disambiguation - ThisRecord could refer to either level dataset. I am not sure your structure will work, but you can start with this. Also note the bottom patch will work much faster.
    ForAll(
       PS_Gallery.AllItems As _PS,
       Collect(
          col_ProductionUploadPatch,
          ForAll(
             PS_Tap_Gallery.AllItems As _Tap,
             {
                ParentTitle: _PS.Title,
                SubGalleryType: "PS_Tap_Gallery,
                SubItemValue1: _Tap.PSTG_Tap_Number_DD.Selected.Value,
                SubItemValue2: _Tap.PSTG_Tap_Time_Fld.Text,
                SubItemValue3: _Tap.PSTG_SOW_Count_Fld.Text
             }
          ),
          ForAll(
             PS_Flux_Gallery.AllItems As _Flux,
             {
                ParentTitle: _PS.Title,
                SubGalleryType: "PS_Flux_Gallery",
                SubItemValue1: _Flux.PSFG_Flux_Type_DD.Selected.Value,
                SubItemValue2: _Flux.PSFG_Flux_Weight_Fld.Text
             }
          ),
          ForAll(
             PS_SOW_Gallery.AllItems AS _SOW,
             {
                ParentTitle: _PS.Title,
                SubGalleryType: "PS_SOW_Gallery",
                SubItemValue1: _SOW.PSSG_SOW_Number_DD.Selected.Value,
                SubItemValue2: _SOW.PSSG_SOW_Tag_Fld.Text,
                SubItemValue3: _SOW.PSSG_SOW_Weight_Fld.Text
             }
          )
       )
    );
    
    Patch(
       ZEB_Production_Dataset_List,
       ForAll(
          col_ProductionUploadPatch As _Data,
          {
             Title: _Data.ParentTitle,
             SubGalleryType: _Data.SubGalleryType,
             SubItemValue1: _Data.SubItemValue1,
             SubItemValue2: _Data.SubItemValue2,
             SubItemValue3: _Data.SubItemValue3
          }
       )
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • Suggested answer
    MS.Ragavendar Profile Picture
    5,011 Super User 2025 Season 2 on at

    We are collecting data from three sub-galleries (PS_Tap_Gallery, PS_Flux_Gallery, and PS_SOW_Gallery) inside a parent gallery (PS_Gallery).

    Combining it into a collection (col_ProductionUploadPatch), and then patching that data to a SharePoint list (ZEB_Production_Dataset_List).

    ✅ STEP 1: Loop through each item in PS_Gallery (your main gallery)

    ForAll(

        PS_Gallery.AllItems,

    This loops through each parent record — e.g., a production batch or a job.

     

    ✅ STEP 2: Create a local variable parentTitle

    With(

        {

            parentTitle: ThisRecord.Title

        },

    This keeps the current item's Title handy so you can use it for every sub-item (sub-gallery entry).

     

    ✅ STEP 3: Add related sub-gallery entries to the collection

    Collect(

        col_ProductionUploadPatch,

    This uses three nested ForAll loops to go through the sub-galleries and collect structured records: 

    🟦 a) PS_Tap_Gallery

    ForAll(

        PS_Tap_Gallery.AllItems,

        {

            ParentTitle: parentTitle,

            SubGalleryType: "PS_Tap_Gallery",

            SubItemValue1: ThisRecord.PSTG_Tap_Number_DD.Selected.Value,

            SubItemValue2: ThisRecord.PSTG_Tap_Time_Fld.Text,

            SubItemValue3: ThisRecord.PSTG_SOW_Count_Fld.Text

        }

    )

    🟦 b) PS_Flux_Gallery

    ForAll(

        PS_Flux_Gallery.AllItems,

        {

            ParentTitle: parentTitle,

            SubGalleryType: "PS_Flux_Gallery",

            SubItemValue1: ThisRecord.PSFG_Flux_Type_DD.Selected.Value,

            SubItemValue2: ThisRecord.PSFG_Flux_Weight_Fld.Text

        }

    )

    🟦 c) PS_SOW_Gallery

    ForAll(

        PS_SOW_Gallery.AllItems,

        {

            ParentTitle: parentTitle,

            SubGalleryType: "PS_SOW_Gallery",

            SubItemValue1: ThisRecord.PSSG_SOW_Number_DD.Selected.Value,

            SubItemValue2: ThisRecord.PSSG_SOW_Tag_Fld.Text,

            SubItemValue3: ThisRecord.PSSG_SOW_Weight_Fld.Text

        }

    )

    ➡️ These all add records to col_ProductionUploadPatch, and each record includes:

    • ParentTitle
    •  SubGalleryType
    •  Up to 3 custom fields: SubItemValue1, SubItemValue2, SubItemValue3
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at
    @WarrenBelz

    After adding a missing close quote everything was good until the end.

    The error is - "Invalid argument type (Table). Expecting a record value instead."
    Patch(
       Production_Dataset_List,
       ForAll(
          col_ProductionUploadPatch As _Data,
          {
             Title: _Data.ParentTitle,
             SubGalleryType: _Data.SubGalleryType,
             SubItemValue1: _Data.SubItemValue1,
             SubItemValue2: _Data.SubItemValue2,
             SubItemValue3: _Data.SubItemValue3
          }
       )
    )
  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at
    The code is valid assuming col_ProductionUploadPatch has those five fields (all Text) and Production_Dataset_List also has the same fields of the same type - I am sure you can see that based on the number of years you have been posting here. The Patch is simply lining up the matching fields and writing them to the data source.
    You might have a look at the content of the two data sets to see what is not matching.
  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at
    @WarrenBelz

    I am now trying to test his in parts.

    Part one, the Collection. This is what I have, however no data is being saved to the
    col_ProductionUploadPatch collection.

    What am I missing?

     
  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at
    @MS.Ragavendar

    I am now trying to test this in parts.

    Part one the Collection. This is what I have for part one, however no data
    is being saved to col_ProductionUploadPatch.

    What am I missing?
     
    ForAll(
        PS_Gallery.AllItems,
        With(
            {
                PSparentTitle: ThisRecord.Title
            },
            Collect(
                col_ProductionUploadPatch,
               
                ForAll(
                    PS_Tap_Gallery.AllItems,
                    {
                        ParentTitle: PSparentTitle,
                        SubGalleryType: "PS_Tap_Gallery",
                        SubItemValue1: ThisRecord.PSTG_Tap_Number_DD.Selected.Value,
                        SubItemValue2: ThisRecord.PSTG_Tap_Time_Fld.Text,
                        SubItemValue3: ThisRecord.PSTG_SOW_Count_Fld.Text
                    }
                ),
               
                ForAll(
                    PS_Flux_Gallery.AllItems,
                    {
                        ParentTitle: PSparentTitle,
                        SubGalleryType: "PS_Flux_Gallery",
                        SubItemValue1: ThisRecord.PSFG_Flux_Type_DD.Selected.Value,
                        SubItemValue2: ThisRecord.PSFG_Flux_Weight_Fld.Text
                    }
                ),
               
                ForAll(
                    PS_SOW_Gallery.AllItems,
                    {
                        ParentTitle: PSparentTitle,
                        SubGalleryType: "PS_SOW_Gallery",
                        SubItemValue1: ThisRecord.PSSG_SOW_Number_DD.Selected.Value,
                        SubItemValue2: ThisRecord.PSSG_SOW_Tag_Fld.Text,
                        SubItemValue3: ThisRecord.PSSG_SOW_Weight_Fld.Text
                    }
                )
            )
        )
    );
     
  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at
    @Michael E. Gernaey

    I beg your patience.

    Some have an assumption that I should know better, after all these years.

    Suffice if to say, I do my best but there are extenuating circumstances that limit some of my understanding.

    Thank you for ALL the assistance you've provided.

    Here is a piece of my flow.

    I have not errors until the Patch to SharePoint section.

    When I click the 'Submit Data' button the 'col_New_Heat_ProductionUploadPatch' does
    NOT populate.



    What am I missing?


    Here is that last section, that patches the collections to SharePoint.

    It is unclear to me what I am missing.

    Thank you!
  • Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
     
    There are a lot of moving parts and people answering and different issues etc.
    I'd like to suggest to make this simpler.. or maybe it will not but like @WarrenBelz said,... realistically its your data so you gotta know how to set the values in all this time.
     
    But, and @WarrenBelz and @MS.Ragavendar bear with me on this as I'm just trying sigh to get us to somewhere.
     
    And Warren correct me if you see this and I'm speaking for you and I am not correct.
     
     
    You had initially 1 problem
    1. You needed individual ForAlls since you had different data sets and you didn't set it up that way
     
    Then Warren explained, to add in Alias's (whether you understand him or not), because you cannot use ThisRecord on sub Loops (ForAlls) for sub data types that are within either a) a With or b) within another Loop. It won't know how to resolve it.
     
    So the question is this, since you said you wanted to test each part. 
    If you just do this does it put items in col_ProductionUploadPatch???
     
    If not the show which field is the error. Then once this works, you can add the next Collect(ForAll
     
    ForAll(
        PS_Gallery.AllItems,
        With(
            {
                parentTitle: ThisRecord.Title
            },
            Collect(
                col_ProductionUploadPatch,
               
                ForAll(
                    PS_Tap_Gallery.AllItems AS _PSTap,
                    {
                        ParentTitle: parentTitle,
                        SubGalleryType: "PS_Tap_Gallery",
                        SubItemValue1: _PSTap.PSTG_Tap_Number_DD.Selected.Value,
                        SubItemValue2: _PSTap.PSTG_Tap_Time_Fld.Text,
                        SubItemValue3: _PSTap.PSTG_SOW_Count_Fld.Text
                    }
                )
            )
        )
    );
     
    Adding in the second
     
    ForAll(
        PS_Gallery.AllItems,
        With(
            {
                parentTitle: ThisRecord.Title
            },
            Collect(col_ProductionUploadPatch,
               
                ForAll(
                    PS_Tap_Gallery.AllItems AS _PSTap,
                    {
                        ParentTitle: parentTitle,
                        SubGalleryType: "PS_Tap_Gallery",
                        SubItemValue1: _PSTap.PSTG_Tap_Number_DD.Selected.Value,
                        SubItemValue2: _PSTap.PSTG_Tap_Time_Fld.Text,
                        SubItemValue3: _PSTap.PSTG_SOW_Count_Fld.Text
                    }
                )
            );
        
            Collect(col_ProductionUploadPatch, 
                ForAll(
                    PS_Flux_Gallery.AllItems As _PSFlux,
                    {
                        ParentTitle: PSparentTitle,
                        SubGalleryType: "PS_Flux_Gallery",
                        SubItemValue1: _PSFlux.PSFG_Flux_Type_DD.Selected.Value,
                        SubItemValue2: _PSFlux.PSFG_Flux_Weight_Fld.Text
                    }
                )
            );
        )
    );
     
    Get all of these added in so you see data, which you say you do not (your post to Warren). Add the next 2 or whatever the same way until you get all the data you want in.
     
    Then we can worry about your Patching all your data...
  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at
    With a capital 'S' in AS there are errors. With a lower case 'S' no errors.

    However, clicking the button does not populate the collection.

    Also, unsure if this has an impact - each sub-gallery 'Add' button has a version of this -
    Collect(colFluxData, {intFluxData: GUID(), rem:false})


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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard