cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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})

 

@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
Continued Contributor
Continued Contributor

@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

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (459)