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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Repeating Table ...
Power Apps
Answered

Patch Repeating Table and Form to SharePoint List in one Button

(0) ShareShare
ReportReport
Posted on by 8

I am creating an app. which  contain one Form (Materialanforderungform) and gallery in this form for repeating table is a collection (coldetails).

I am trying to save the two Patch in one list in SP and use one Button.

the patch of repeating table is done but i cant save the data from the form in the same line of repeating table.

 Curruntly my code of Patch  for Form is:

//SubmitForm(MaterialanforderungForm);;

Patch(

    'Materialanforderung Liste'; Defaults('Materialanforderung Liste');

    {       

     Lieferanten: LieferantenDataCardValue.Text;

        Zustandshinweis: ZustandshinweisDataCardValue.Text;

        'Bereich / Kostenstelle': KostenstelleTextInput.Text;

        Kostenstelle:BKDataCardValue;

        Anlagen: AnlagenDataCardValue;

        'Gewünschter Liefertermin': 'Gewünschter LieferterminDataCardValue'.SelectedDate;

         //Lookup columns

        Firma: FirmaDataCardValue;

        'Standort Anforderer': standOrtDataCardValue;

        Lieferort: ddLieferOrt.Selected;

        //Person column

        Anforderer: {

            Claims: "i:0#.f|membership|" & Lower(AnfordererDataCardValue.Selected.Mail);

            DisplayName: AnfordererDataCardValue.Selected.DisplayName;

            Department: AnfordererDataCardValue.Selected.Department;

            Email: AnfordererDataCardValue.Selected.Mail;

            JobTitle: AnfordererDataCardValue.Selected.JobTitle;

            Picture: ""

        };

        'Kostenstelle Verantwortlicher': {

            Claims: "i:0#.f|membership|" & Lower(KostenstelleVATextInput.Text);

            DisplayName: KostenstelleVATextInput.Text;

            Department: "";

            Email: KostenstelleVATextInput.Text;

            JobTitle: "";

            Picture: ""

        }

)

Here is a collection patch

       

        'Optional Beteiligter': ForAll(

            OptionalBeiteiligterDataCardValue.SelectedItems;

            {

                Claims: "i:0#.f|membership|" & ThisRecord.Mail;

                // Lower(AnfordererDataCardValue.Selected.Mail); 

                DisplayName: ThisRecord.DisplayName;

                Department: ThisRecord.Department;

                Email: ThisRecord.Mail;

                JobTitle: ThisRecord.JobTitle;

                Picture: ""

            }

        )

      // ;'Status (Status0)':{Value: "New"}

           }

);;

 If(

    CountRows(colDetails) > 0;

    ForAll(

        colDetails;

        If(

            !IsBlank(LineBezeichnung);

            Patch(

                'Materialanforderung Liste';

                Defaults('Materialanforderung Liste');

               // MaterialanforderungForm.Updates;

                   {

                   //IDTable:First(colPatchBase).ID;

                   // IDTable:Value( First(colPatchBase).IDTable) ;

                    //*******Single line of text columns****/

                   'Bezeichnung Title': Text(LineBezeichnung);

                    Investnummer: Text(LineInv);

                    Art: LineArt.Value;

                    /***Number columns******/

                   'Einzelpreise/Nettopreise': Value(LinePriseNetto);

                    'Gesamtpreis/Nettopreis': Value(LineGesNetto);

                    'Einkaufspreis/Brutto': Value(LineGesBrutto);

                    'Menge/Einheit': Value(LineMenge)

                    ;IDTable: MaterialanforderungForm.LastSubmit.ID 

                }

            )

           

        )

    )

)

;;

 RequestHide();;

 // check for errors

If(

    IsEmpty(Errors('Materialanforderung Liste'));

    // on Success

    Notify(

       // Success;

        "Thank You For Submitting The Data";

        NotificationType.Success

    );

       // on failure

    Notify(

        "Failed to start session! Error:  ";//Last(Errors('Materialanforderung Liste')).Message;

        //Concat(Errors('Materialanforderung Liste'); Column & ": " & Message);

        First(Errors('Materialanforderung Liste')).Message;

        NotificationType.Error

    )

);;

Set(varEditForm;false);;

ResetForm(MaterialanforderungForm);;

Clear(colDetails);;

Navigate(HomeScreen);;

//Refresh('Materialanforderung Liste');;

//RequestHide();;


 Updating Media

Thanks

SP.png
Categories:
  • WarrenBelz Profile Picture
    156,538 Most Valuable Professional on at

    Hi @Rasha_Alaydi ,

    What exactly do you mean by the patch of repeating table is done but i cant save the data from the form in the same line of repeating table.

    Which part of the code works for you and it is you are trying to save the entire collection (if more than one record) and are you trying to create new record/s or update existing record/s ?

  • WarrenBelz Profile Picture
    156,538 Most Valuable Professional on at

    Hi @Rasha_Alaydi ,

    What exactly do you mean by the patch of repeating table is done but i cant save the data from the form in the same line of repeating table.

    Which part of the code works for you and it is you are trying to save the entire collection (if more than one record) and are you trying to create new record/s or update existing record/s ?

  • Rasha_Alaydi Profile Picture
    8 on at

    The two Patch are correct and i can save the  Patch collection of repeating table in separate rows, i want to save another Data from Form in this row.

    i put the collection patch in succuss form and the patch for the base Form in Buton.

     

    2.jpg
    1.jpg
  • WarrenBelz Profile Picture
    156,538 Most Valuable Professional on at

    @Rasha_Alaydi ,

    That does not really clarify my question - which part of the code works for you (and what it not working) and are you are trying to save the entire collection (if more than one record) and do you want to create new record/s or update existing record/s ?

  • Rasha_Alaydi Profile Picture
    8 on at
    1. which part of the code it not working)  : this is code of the main form save the data in new record separately not in the same record of new collection patch (Repeating Table)

    SubmitForm(MaterialanforderungForm);;

    Patch(

        'Materialanforderung Liste'; Defaults('Materialanforderung Liste');

        {       

         Lieferanten: LieferantenDataCardValue.Text;

            Zustandshinweis: ZustandshinweisDataCardValue.Text;

            'Bereich / Kostenstelle': KostenstelleTextInput.Text;

            Kostenstelle:BKDataCardValue;

            Anlagen: AnlagenDataCardValue;

            'Gewünschter Liefertermin': 'Gewünschter LieferterminDataCardValue'.SelectedDate;

             //Lookup columns

            Firma: FirmaDataCardValue;

            'Standort Anforderer': standOrtDataCardValue;

            Lieferort: ddLieferOrt.Selected;

            //Person column

            Anforderer: {

                Claims: "i:0#.f|membership|" & Lower(AnfordererDataCardValue.Selected.Mail);

                DisplayName: AnfordererDataCardValue.Selected.DisplayName;

                Department: AnfordererDataCardValue.Selected.Department;

                Email: AnfordererDataCardValue.Selected.Mail;

                JobTitle: AnfordererDataCardValue.Selected.JobTitle;

                Picture: ""

            };

            'Kostenstelle Verantwortlicher': {

                Claims: "i:0#.f|membership|" & Lower(KostenstelleVATextInput.Text);

                DisplayName: KostenstelleVATextInput.Text;

                Department: "";

                Email: KostenstelleVATextInput.Text;

                JobTitle: "";

                Picture: ""

            }

    )

            'Optional Beteiligter': ForAll(

                OptionalBeiteiligterDataCardValue.SelectedItems;

                {

                    Claims: "i:0#.f|membership|" & ThisRecord.Mail;

                    // Lower(AnfordererDataCardValue.Selected.Mail); 

                    DisplayName: ThisRecord.DisplayName;

                    Department: ThisRecord.Department;

                    Email: ThisRecord.Mail;

                    JobTitle: ThisRecord.JobTitle;

                    Picture: ""

                } ) });;

    2. are you are trying to save the entire collection (if more than one record): Yes ; i am trying to repeat the same master data according the  Collection repeated record, 

     and my code save more than new record 

    If(

        CountRows(colDetails) > 0;

        ForAll(

            colDetails;

            If(

                !IsBlank(LineBezeichnung);

                Patch(

                    'Materialanforderung Liste';

                    Defaults('Materialanforderung Liste');

                       {

                       //*******Single line of text columns****/

                       'Bezeichnung Title': Text(LineBezeichnung);

                        Investnummer: Text(LineInv);

                        Art: LineArt.Value;

                        /***Number columns******/

                       'Einzelpreise/Nettopreise': Value(LinePriseNetto);

                        'Gesamtpreis/Nettopreis': Value(LineGesNetto);

                        'Einkaufspreis/Brutto': Value(LineGesBrutto);

                        'Menge/Einheit': Value(LineMenge)

                       // ;IDTable: MaterialanforderungForm.LastSubmit.ID  

                    ;IDTable::Value(LineID)

                    } ) )));;

     

    3. do you want to create new record: yes 

     

     

  • WarrenBelz Profile Picture
    156,538 Most Valuable Professional on at

    @Rasha_Alaydi ,

    OK - firstly I have to assume that all the values on the right side of the Patch are in the collection and that your field types are correct (everything but LineArt (which is a Choice column) is Text. As well, I will offer some fundamental advice here that may assist with this and future ForAll() exercises. It is not designed to be a Loop, although it can work this way with considerable performance penalty as it does an individual Patch for each record. ForAll() creates a Table, which can be patched in one action provided its content is correct. For new records, this is simply a Table with field names and field types matching the list. For existing records, including the SharePoint record ID in the table causes it to update that record for each of the Table records.

    If(
     CountRows(colDetails) > 0;
     Patch(
     'Materialanforderung Liste';
     ForAll(
     Filter(
     colDetails;
     !IsBlank(LineBezeichnung)
     ) As aPatch;
     {
     'Bezeichnung Title': aPatch.LineBezeichnung;
     Investnummer: aPatch.LineInv;
     Art: aPatch.LineArt.Value;
     'Einzelpreise/Nettopreise': Value(aPatch.LinePriseNetto);
     'Gesamtpreis/Nettopreis': Value(aPatch.LineGesNetto);
     'Einkaufspreis/Brutto': Value(aPatch.LineGesBrutto);
     'Menge/Einheit': Value(aPatch.LineMenge);
     IDTable: Value(aPatch.LineID)
     } 
     ) 
     )
    );;

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Rasha_Alaydi Profile Picture
    8 on at

    Thanks,  @WarrenBelz  the code is not working. it patch one column.

    I want to save data like this video ; but save that in one list 

    https://www.youtube.com/watch?v=Qp458n1q2bo&t=90s 

     

  • Verified answer
    WarrenBelz Profile Picture
    156,538 Most Valuable Professional on at

    @Rasha_Alaydi ,

    Sorry I do not have time to watch a video, but the code I posted will patch all rows of colDetails where the field LineBezeichnung is not blank into 'Materialanforderung Liste' as new records. I noted that everything in my code with aPatch in front needs to be a field in the collection, If it is not (a Variable or control name), you need to remove aPatch. from the front of it.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard