Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Assistance with Finishing Patch of Multiple Galleries to SP List

(1) ShareShare
ReportReport
Posted on by 4,941 Super User 2025 Season 1
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
        }
    )
)
  • WarrenBelz Profile Picture
    147,809 Most Valuable Professional on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    And this is how you have (again) confused everyone. Your initial posted code structure appeared to be attempting to patch a Gallery with three nested sub-galleries and I referred to this in a couple of my responses. These are obviously four seperate galleries and you are adding them to the same list - a very simple task if any of us knew what you wanted.
    Please (and I ask with the best intentions of assisting you), post the whole issue in your initial post including screen shots if applicable and try to give a brief description of the issue - what is happening now and what you want to happen.
  • Suggested answer
    Phineas Profile Picture
    4,941 Super User 2025 Season 1 on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    This seems to have done it.

    Six lines of input. All base data on each line with each gallery item reflected.

    THANK YOU ALL FOR YOUR PATIENCE.
     
        ForAll(
        PS_Tap_Gallery.AllItems,    
        Patch(
            Production_Dataset_List,
            Defaults(Production_Dataset_List),
            {
            Tap_Number: PSTG_Tap_Number_DD.Selected.Value,
            Tap_Time: PSTG_Tap_Time_Fld.Text,
            Tap_SOW_Count: PSTG_SOW_Count_Fld.Text,    
            Heat_Date: DateValue(PS_Date_Fld.Text),
            Title: PS_Heat_Number_Fld.Text,
            Production_Add_Time: PS_Start_Time_Fld.Text,
            Supervisor_Name: PS_Manager_Name_Fld.Text,
            ST_TOLL_BS: PS_ST_Toll_BS_Fld.Text,
            Delivery_Number: PS_Delivery_Number_Fld.Text,
            Campaign: PS_Campaign_Number_Fld.Text,
            Tag_Number: PS_Tag_Number_Fld.Text,
            Furnace: PS_Furnace_Number_Fld.Text,
            Expected_Recovery: PS_Expected_Recovery_Fld.Text,
            Supplier: PS_Supplier_Name_Fld.Text,
            Commodity: PS_Commodity_Fld.Text,
            Weight_In: PS_Weight_In_Fld.Text,
            Weight_Out: PS_Weight_Out_Fld.Text,
            Recovery: PS_Recovery_Fld.Text,
            Sow_Master: PS_SOW_Master_Count_Fld.Text
            }
        ));
        ForAll(
        PS_SOW_Gallery.AllItems,    
        Patch(
            Production_Dataset_List,
            Defaults(Production_Dataset_List),
            {
            Sow_1: PSSG_SOW_Number_DD.Selected.Value,
            SOW_Tag_Number: PSSG_SOW_Tag_Fld.Text,
            SOW_Weight: PSSG_SOW_Weight_Fld.Text,  
            Heat_Date: DateValue(PS_Date_Fld.Text),
            Title: PS_Heat_Number_Fld.Text,
            Production_Add_Time: PS_Start_Time_Fld.Text,
            Supervisor_Name: PS_Manager_Name_Fld.Text,
            ST_TOLL_BS: PS_ST_Toll_BS_Fld.Text,
            Delivery_Number: PS_Delivery_Number_Fld.Text,
            Campaign: PS_Campaign_Number_Fld.Text,
            Tag_Number: PS_Tag_Number_Fld.Text,
            Furnace: PS_Furnace_Number_Fld.Text,
            Expected_Recovery: PS_Expected_Recovery_Fld.Text,
            Supplier: PS_Supplier_Name_Fld.Text,
            Commodity: PS_Commodity_Fld.Text,
            Weight_In: PS_Weight_In_Fld.Text,
            Weight_Out: PS_Weight_Out_Fld.Text,
            Recovery: PS_Recovery_Fld.Text,
            Sow_Master: PS_SOW_Master_Count_Fld.Text
            }
        ));
        ForAll(
        PS_Flux_Gallery.AllItems,    
        Patch(
            Production_Dataset_List,
            Defaults(Production_Dataset_List),
            {
            Flux_Type: PSFG_Flux_Type_DD.Selected.Value,
            Flux_Weight: Value(PSFG_Flux_Weight_Fld.Text),        
            Heat_Date: DateValue(PS_Date_Fld.Text),
            Title: PS_Heat_Number_Fld.Text,
            Production_Add_Time: PS_Start_Time_Fld.Text,
            Supervisor_Name: PS_Manager_Name_Fld.Text,
            ST_TOLL_BS: PS_ST_Toll_BS_Fld.Text,
            Delivery_Number: PS_Delivery_Number_Fld.Text,
            Campaign: PS_Campaign_Number_Fld.Text,
            Tag_Number: PS_Tag_Number_Fld.Text,
            Furnace: PS_Furnace_Number_Fld.Text,
            Expected_Recovery: PS_Expected_Recovery_Fld.Text,
            Supplier: PS_Supplier_Name_Fld.Text,
            Commodity: PS_Commodity_Fld.Text,
            Weight_In: PS_Weight_In_Fld.Text,
            Weight_Out: PS_Weight_Out_Fld.Text,
            Recovery: PS_Recovery_Fld.Text,
            Sow_Master: PS_SOW_Master_Count_Fld.Text
            }
        )            
    )
     
  • WarrenBelz Profile Picture
    147,809 Most Valuable Professional on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    Yes @Michael E. Gernaey - I agree we need to get this moving and thanks for the push-along.
    Firstly please do not create new posts on the same issue (again with half the story) and make everyone start again.
    I said in my initial post that I was not sure your structure would work - I was not on my PC at the time to test and I had never needed in the past to try what you are attempting. My suspicions were correct in testing I did here - although the code is structurally valid, Power Apps will not pick up the contents of sub-gallery controls inside a gallery record like that. You would actually need to have the code based on the Items
    of the sub-gallery and how that relate to the main record.
    So what is the Items of the sub-galleries ?
     
     
  • Phineas Profile Picture
    4,941 Super User 2025 Season 1 on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    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})


  • Michael E. Gernaey Profile Picture
    43,177 Super User 2025 Season 1 on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
     
    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
    4,941 Super User 2025 Season 1 on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    @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!
  • Phineas Profile Picture
    4,941 Super User 2025 Season 1 on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    @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
    4,941 Super User 2025 Season 1 on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    @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?

     
  • WarrenBelz Profile Picture
    147,809 Most Valuable Professional on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    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
    4,941 Super User 2025 Season 1 on at
    Assistance with Finishing Patch of Multiple Galleries to SP List
    @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
          }
       )
    )

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >