Skip to main content

Notifications

Power Apps Pro Dev & ISV
Unanswered

Issue: Power Apps Patch Function Not Saving Data from Collection

Posted on by 6

 

I have an app in Power Apps that registers contract information with suppliers and stores it in an Excel sheet. The app includes a screen where the user can specify the number of suppliers (via an input box), and fields for each supplier are automatically generated.

I’m using the ClearCollect function to gather supplier information into a collection (LeverandorCollection), and then a ForAll function to iterate through the collection and save the data to an Excel table. However, while the form data is saved correctly, the data from the collection (supplier-specific information) is not being transferred or saved to the Excel sheet.

Here's the Patch function I'm currently using:

 
ForAll(
LeverandorCollection;
Patch(
Tabell2;
Defaults(Tabell2);
{
Leverandør: ThisRecord.LeverandorNavn;
'17 Organisasjonsummer': ThisRecord.OrgNummer;
'19 Kontaktperson leverandør (navn)': ThisRecord.KontaktNavn;
'20 Kontaktperson leverandør (epost)': ThisRecord.KontaktEpost;
'21 Fakturamerking/referanse': ThisRecord.FakturaReferanse
};
RegistrerFlereLeverandører.Updates
)
)

Despite this, only the form data is saved, and none of the supplier data from the collection gets through. What might be causing this, and how can I ensure the supplier data is saved correctly?

  • scalca Profile Picture
    scalca 139 on at
    Issue: Power Apps Patch Function Not Saving Data from Collection
    do you get any error message ? 
    can you confirm connection to excel online sheet is working ? 
    can you check if you get any information from the excel sheet into the app just to be sure you are connected to the excel sheet ? 
  • SS-02100810-0 Profile Picture
    SS-02100810-0 6 on at
    Issue: Power Apps Patch Function Not Saving Data from Collection
    Hi, and thank you for your solution attempt. 

    When removing the .Updates part, nothing transfers to the excel table. When included atleast information from the form RegistrerFlereLeverandører gets transfered and stored. 

    A bit tricky this one. 

    Best regards,
    Simen

     
  • Nandit Profile Picture
    Nandit 752 on at
    Issue: Power Apps Patch Function Not Saving Data from Collection
     
    I don't think you need the RegistrerFlereLeverandører.Updates part in your code. 
    You just need the following to make it work:
    ForAll(
    LeverandorCollection;
    Patch(
    Tabell2;
    Defaults(Tabell2);
    {
    Leverandør: ThisRecord.LeverandorNavn;
    '17 Organisasjonsummer': ThisRecord.OrgNummer;
    '19 Kontaktperson leverandør (navn)': ThisRecord.KontaktNavn;
    '20 Kontaktperson leverandør (epost)': ThisRecord.KontaktEpost;
    '21 Fakturamerking/referanse': ThisRecord.FakturaReferanse
    }))
     
    Hope this helps. 
     
    Kind regards, 
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
     

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

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 141,122

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,414

Leaderboard