cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abbyamante
Helper II
Helper II

Powerapps forAll + PATCH function Very Slow

Hello experts! 

i am really desperate for help here. (i cant sleep anymore thinking about this lol!) so here is my situation. i have created a canvas app for site visit form. im using a SP list as my data source for form template and another SP list for the results. Now, i created the form without using form control in powerapps because there are 122 questions and i didnt want to create 122 columns in SP list so i used Gallery instead. Long story short i have to section the questions so the user doesnt get overwhelmed with one big form so i ended up creating 15 different galleries. so far everything is working fine but its VERY SLOWWWW when i patch the 15 galleries ALL items (total of 122 questions) to sp list.

 

I have to patch all the items (all questions) in the gallery so that it would be on the SP list . The purpose of this is because the user may not be able to finish the form. User will save the draft and continue later. i have to patch all the question to the sp list so they can come back and answer the rest of the question or edit.

 

i saw this blog and tried to follow it https://www.matthewdevaney.com/patch-multiple-records-in-power-apps-10x-faster/ and this https://www.matthewdevaney.com/fastest-way-to-patch-all-gallery-items-power-apps/ but i cant figure out how to apply it on my patch function.

 

Please help!!

 

here is my function and i  repeated the code 15 times for each gallery, separating them function by ";"

 

 

 

ForAll(
    Gal_Staff.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Title: btn_title_Staffing.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Staff.Text,
            Questions: lbl_qstions_Staff.Text,
            Comment: txtInpt_forNo_Staff.Text,
            'Overall Comments': txtInpt_Answer_Staff.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Staff.Selected.Value
            ),
            ColType: lbl_Coltyp_Staff.Text
        }
    )
);
ForAll(
    Gal_PSOS.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_PSOS.Text,
            Title: btn_title_PSOS.Text,
            Questions: lbl_qstions_PSOS.Text,
            Comment: txtInpt_forNo_PSOS.Text,
            'Overall Comments': txtInpt_Answer_PSOS.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_PSOS.Selected.Value
            ),
            ColType: lbl_Coltyp_PSOS.Text
        }
    )
);
ForAll(
    Gal_Quality.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Quality.Text,
            Title: btn_title_Quality.Text,
            Questions: lbl_qstions_Quality.Text,
            Comment: txtInpt_forNo_Quality.Text,
            'Overall Comments': txtInpt_Answer_Quality.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Quality.Selected.Value
            ),
            ColType: lbl_Coltyp_Quality.Text
        }
    )
);
ForAll(
    Gal_EE.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_EE.Text,
            Title: btn_title_EE.Text,
            Questions: lbl_qstions_EE.Text,
            Comment: txtInpt_forNo_EE.Text,
            'Overall Comments': txtInpt_Answer_EE.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_EE.Selected.Value
            ),
            ColType: lbl_Coltyp_EE.Text
        }
    )
);
ForAll(
    Gal_Usp795.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Usp795.Text,
            Title: btn_title_795.Text,
            Questions: lbl_qstions_Usp795.Text,
            Comment: txtInpt_forNo_Usp795.Text,
            'Overall Comments': txtInpt_Answer_Usp795.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Usp795.Selected.Value
            ),
            ColType: lbl_Coltyp_795.Text
        }
    )
);
ForAll(
    Gal_Usp797.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Usp797.Text,
            Title: btn_title_797.Text,
            Questions: lbl_qstions_Usp797.Text,
            Comment: txtInpt_forNo_Usp797.Text,
            'Overall Comments': txtInpt_Answer_Usp797.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Usp797.Selected.Value
            ),
            ColType: lbl_Coltyp_Usp797.Text
        }
    )
);
ForAll(
    Gal_Narc.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Narc.Text,
            Title: btn_title_Narc.Text,
            Questions: lbl_qstions_Narc.Text,
            Comment: txtInpt_forNo_Narc.Text,
            'Overall Comments': txtInpt_Answer_Narc.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Narc.Selected.Value
            ),
            ColType: lbl_Coltyp_Narc.Text
        }
    )
);
ForAll(
    Gal_Inv.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Inv.Text,
            Title: btn_title_Inv.Text,
            Questions: lbl_qstions_Inv.Text,
            Comment: txtInpt_forNo_Inv.Text,
            'Overall Comments': txtInpt_Answer_Inv.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Inv.Selected.Value
            ),
            ColType: lbl_Coltyp_Inv.Text
        }
    )
);
ForAll(
    Gal_Prepk.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Prepk.Text,
            Title: btn_title_Prepk.Text,
            Questions: lbl_qstions_Prepk.Text,
            Comment: txtInpt_forNo_Prepk.Text,
            'Overall Comments': txtInpt_Answer_Prepk.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Prepk.Selected.Value
            ),
            ColType: lbl_Coltyp_Prepk.Text
        }
    )
);
ForAll(
    Gal_AutoOp.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_AutoOp.Text,
            Title: btn_title_AutoOp.Text,
            Questions: lbl_qstions_AutoOp.Text,
            Comment: txtInpt_forNo_AutoOp.Text & Concat(
                Filter(
                    Gal_ChkBox_AutoOp.AllItems,
                    Checkbox1.Value
                ),
                Checkbox1.Text,
                ";"
            ),
            'Overall Comments': txtInpt_Answer_AutoOp.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_AutoOp.Selected.Value
            ),
            ColType: lbl_Coltyp_AutoOp.Text
        }
    )
);
ForAll(
    Gal_Compliance.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Compliance.Text,
            Title: btn_title_Compliance.Text,
            Questions: lbl_qstions_Compliance.Text,
            Comment: txtInpt_forNo_Compliance.Text,
            'Overall Comments': txtInpt_Answer_Compliance.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Compliance.Selected.Value
            ),
            ColType: lbl_Coltyp_Compliance.Text
        }
    )
);
ForAll(
    Gal_Ekit.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Ekit.Text,
            Title: btn_title_Ekit.Text,
            Questions: lbl_qstions_Ekit.Text,
            Comment: txtInpt_forNo_Ekit.Text & Concat(
                Filter(
                    Gal_Chkbox_Ekit.AllItems,
                    Checkbox2.Value
                ),
                Checkbox2.Text,
                ";"
            ),
            'Overall Comments': txtInpt_Answer_Ekit.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Ekit.Selected.Value
            ),
            ColType: lbl_Coltyp_Ekit.Text
        }
    )
);
ForAll(
    Gal_Usp800.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Usp800.Text,
            Title: btn_title_Usp800.Text,
            Questions: lbl_qstions_Usp800.Text,
            Comment: txtInpt_forNo_Usp800.Text,
            'Overall Comments': txtInpt_Answer_Usp800.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Usp800.Selected.Value
            ),
            ColType: lbl_Coltyp_Usp800.Text
        }
    )
);
ForAll(
    Gal_Returns.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Returns.Text,
            Title: btn_title_Returns.Text,
            Questions: lbl_qstions_Returns.Text,
            Comment: txtInpt_forNo_Returns.Text,
            'Overall Comments': txtInpt_Answer_Returns.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Returns.Selected.Value
            ),
            ColType: lbl_Coltyp_Returns.Text
        }
    )
);
ForAll(
    Gal_RxTask.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Rxtask.Text,
            Title: btn_title_RxTask.Text,
            Questions: lbl_qstions_RxTask.Text,
            Comment: txtInpt_forNo_RxTask.Text,
            'Overall Comments': txtInpt_Answer_RxTask.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_RxTask.Selected.Value
            ),
            ColType: lbl_Coltyp_RxTask.Text
        }
    )
);
ForAll(
    Gal_PasMed.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_PasMed.Text,
            Title: btn_title_PasMed.Text,
            Questions: lbl_qstions_PasMed.Text,
            Comment: txtInpt_forNo_PasMed.Text,
            'Overall Comments': txtInpt_Answer_PasMed.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_PasMed.Selected.Value
            ),
            ColType: lbl_Coltyp_PasMed.Text
        }
    )
);
ForAll(
    Gal_RvrseDist.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_RvrseDist.Text,
            Title: btn_title_RvrseDist.Text,
            Questions: lbl_qstions_RvrseDist.Text,
            Comment: txtInpt_forNo_RvrseDist.Text,
            'Overall Comments': txtInpt_Answer_RvrseDist.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_RvrseDist.Selected.Value
            ),
            ColType: lbl_Coltyp_RvrseDist.Text
        }
    )
);
ForAll(
    Gal_HH.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_HH.Text,
            Title: btn_title_HH.Text,
            Questions: lbl_qstions_HH.Text,
            Comment: txtInpt_forNo_HH.Text,
            'Overall Comments': txtInpt_Answer_HH.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_HH.Selected.Value
            ),
            ColType: lbl_Coltyp_HH.Text
        }
    )
);
ForAll(
    Gal_PsOrg.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_PsOrg.Text,
            Title: btn_title_PsOrg.Text,
            Questions: lbl_qstions_PsOrg.Text,
            Comment: txtInpt_forNo_PsOrg.Text,
            'Overall Comments': txtInpt_Answer_PsOrg.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_PsOrg.Selected.Value
            ),
            ColType: lbl_Coltyp_PsOrg.Text
        }
    )
);
ForAll(
    Gal_NewBus.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
           'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_NewBus.Text,
            Title: btn_title_NewBus.Text,
            Questions: lbl_qstions_NewBus.Text,
            Comment: txtInpt_forNo_NewBus.Text,
            'Overall Comments': txtInpt_Answer_NewBus.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_NewBus.Selected.Value
            ),
            ColType: lbl_Coltyp_NewBus.Text
        }
    )
);
ForAll(
    Gal_Conclusions.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
           'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_Conclusions.Text,
            Title: btn_title_Conclusions.Text,
            Questions: lbl_qstions_Conclusions.Text,
            Comment: txtInpt_forNo_Conclusions.Text,
            'Overall Comments': txtInpt_Answer_Conclusions.Text,
            Answers: LookUp(
                Split(
                    "Yes;No;NA",
                    ";"
                ),
                Value = radioYN_Conclusions.Selected.Value
            ),
            ColType: lbl_Coltyp_Conclusions.Text
        }
    )
);
ForAll(
    Gal_RvwrNotes.AllItems,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: dp_SiteVisitDate_Info.SelectedDate,
           'Location': dd_Loc_Info.SelectedText.Value,
            'RDO/RGM': lbl_rdoRgm_Val.Text,
            PIC: lbl_Pic_Val.Text,
            Status: DD_Status.SelectedText,
            Sort: lbl_sort_RvwrNotes.Text,
            Title: btn_title_RvwrNotes.Text,
            Questions: lbl_qstions_RvwrNotes.Text,
            'Overall Comments': txtInpt_Answer_RvwrNotes.Text,
            ColType: lbl_Coltyp_RvwrNotes.Text
        }
    )
);
Set(
    varReset,
    false
);
Set(
    varReset,
    true
);
Notify(
    "Your draft has been saved",
    NotificationType.Success
);
Navigate(Screen_Home)
//Set(varDropDownDefault,"Draft")

 

 

 

18 REPLIES 18

If every gallery has the same metadata structure, try to use

 

Collect(MyCollection, Gallery1.AllItems);

Collect(MyCollection, Gallery2.AllItems);

...

 

And then

ForAll(MyCollection, Patch(SharePointList, Defaults(SharePointList),{Your structure})

 

abbyamante
Helper II
Helper II

@FishinKmac 

i didnt use the form because each individual questions would have to be individual columns in the sharepoint list. 

i tried doing it though (i created 122 columns in sp) with the form control but the app loads very slow. its about 6mins before it fully load. 

 

i have 2 sp list. one for question template and one for saving the results.

 

i need to patch each questions and answer results as individual row in sp list. like this:

 

abbyamante_0-1705613926412.png

 

@enriqueglopez - yes, all the galleries has the same structure. on what property do i put the collect?

OKay next question ... (sorry for all of the questions)  For each gallery are you adding new line items in the form? From what i can tell you are just answering single questions with some conditions. 

 

I still dont think you need a gallery, maybe a container and some controls on the screen but not a gallery. If you aren't adding new line items the for all is really only looking at one items and multiple controls for the one item. 

 

If that is the case i would have restructure as I suggested above and then have a next button that is present on each screen with a code similar to this 

Next Button OnSelect

Switch(varSection, 
"Staffing", 
Collect(colSiteVisit, 
{
            LineVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            LineLocation: dd_Loc_Info.SelectedText.Value,
            LineRDORGM: lbl_rdoRgm_Val.Text,
            LinePIC: lbl_Pic_Val.Text,
            LineTitle: btn_title_Staffing.Text,
            LineStatus: DD_Status.SelectedText,
            LineSort: lbl_sort_Staff.Text,
            LineQuestions: lbl_qstions_Staff.Text,
            LineComments: txtInpt_forNo_Staff.Text,
            LineOverallComments: txtInpt_Answer_Staff.Text,
            LineAnswers: radioYN_Staff.Selected.Value,
            LineColType: lbl_Coltyp_Staff.Text
        })
, 
"PSOS", 
Collect(colSiteVisit
 {
            LineVisitDate: dp_SiteVisitDate_Info.SelectedDate,
            LineLocation: dd_Loc_Info.SelectedText.Value,
            LineRDORGM: lbl_rdoRgm_Val.Text,
            LinePTC: lbl_Pic_Val.Text,
            LineStatus: DD_Status.SelectedText,
            LineSort: lbl_sort_PSOS.Text,
            LineTitle: btn_title_PSOS.Text,
            LineQuestions: lbl_qstions_PSOS.Text,
            LineComments: txtInpt_forNo_PSOS.Text,
            LineOverallComments: txtInpt_Answer_PSOS.Text,
            LineAnswers: LradioYN_PSOS.Selected.Value,            ),
            LineColType: lbl_Coltyp_PSOS.Text
        }))

 

Then you can have a Save Button that Patches

ForAll(
    colSiteVisit,
    Patch(
        'Site Visit Form Results',
        Defaults('Site Visit Form Results'),
        {
            SiteVisitDate: LineVisitDate.SelectedDate,
           'Location': LineLocation.Value,
            'RDO/RGM': LineRDORGM.Text,
            PIC: LinePIC.Text,
            Status: LineStatus.Text,
            Sort: LineSort.Text,
            Title: LineTitle.Text,
            Questions: LineQuestion.Text,
            'Overall Comments': LineOverallComment.Text,
            Answers: LineAnswer.Value
            ColType: LineColeTyle.Text

        }
    )
)

 

Something along these lines

@abbyamante , looking at that form, I honestly think the best solution might be to patch as you go...meaning, every time the user updates a question, go ahead and patch that record back. This would avoid the ForAlls and the need for a collection.


To do that, you can add this to the OnChange for the radio button control.

Patch(datasource,thisrecord)

@jrletner i agree. i just need to figure out how to send the data to collections even though the user did not made an update.

@abbyamante ,

 

I have built an example of what I'm suggesting. I have a datasource and a radio button control. As soon as I click an option on the radio button, it immediately patches the datasource with the new value. 

This prevents a ForAll or a Collection from having to handle the patch.


In this example, the value on the left corresponds with the option selected in the radio button. As soon as the radio button is changed, the record is immediately patched back to the datasource and the value on the left updates (because it's pointing to that field in the datasource). Is this what you're trying to do?

 

jrletner_1-1705630864627.png


Now they change:

jrletner_2-1705630893220.png


I put this code in the OnChange property of the radio button control:

jrletner_3-1705630926360.png

 

 

@jrletner yes i tried this. and it does work. but it only works if i made a change on the radio button. i need to patch all items in the gallery even though there is NO change in the item. here is the reason for this.

 

the form has 122 questions. i sectioned the questions into 15 galleries. (i divided the 122 questions to 15 galleries). when the user creates a new form normally they only finish 2 sections of the form. I need to create a function that will allow the user to save and continue later. So what i did is even though the user did made a change or update on the rest of the sections of the form. i patch all the items (the items are basically the questions) in the sharepoint. then i created another gallery so the user can continue to fill out the rest of the sections of the form. 

 

your suggestion above is absolutely working and it patch to the sharepoint list. but its missing the rest of the questions. So when the user comes back they wont be able to fill out the rest of the form because the rest of the question is missing

jrletner
Responsive Resident
Responsive Resident

@abbyamante I understand now. So, yes, a collection is the way to go. 

 

The easiest way to do this is in the OnStart property of your App:

 

ClearCollect(myCollection, myDataSource)  <--- this creates a collection from the datasource

 

Then, have your gallery point to the Collection.

 

Then, OnChange of the Radio Button Control:   

 

Patch(myCollection, ThisItem)  <--- as the user makes changes, the collection is patched with the updates.

 

When the user is done: 

 

Patch(myDataSource, myCollection)  <--- this will patch all records from the collection back to the datasource in one mass update (instead of a ForAll).

Helpful resources

Announcements

Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip: Community User Groups

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: Community User Groups and YOU Being part of, starting, or leading a User Group can have many great benefits for our community members who want to learn, share, and connect with others who are interested in the Microsoft Power Platform and the low-code revolution.   When you are part of a User Group, you discover amazing connections, learn incredible things, and build your skills. Some User Groups work in the virtual space, but many meet in physical locations, meaning you have several options when it comes to building community with people who are learning and growing together!   Some of the benefits of our Community User Groups are: Network with like-minded peers and product experts, and get in front of potential employers and clients.Learn from industry experts and influencers and make your own solutions more successful.Access exclusive community space, resources, tools, and support from Microsoft.Collaborate on projects, share best practices, and empower each other. These are just a few of the reasons why our community members love their User Groups. Don't wait. Get involved with (or maybe even start) a User Group today--just follow the tips below to get started.For current or new User Group leaders, all the information you need is here: User Group Leader Get Started GuideOnce you've kicked off your User Group, find the resources you need:  Community User Group ExperienceHave questions about our Community User Groups? Let us know! We are here to help you!

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!  

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Top Solution Authors
Top Kudoed Authors
Users online (3,175)