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 number of Blank ...
Power Apps
Answered

Patch number of Blank Records depending on numeric value

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello All,

 

When I submit a record to SharepointList1 with "Reference" and "Total Loads", I would like it to create a number of records in SharepointList2.

 

Example - SharepointList1 = Reference: "REF",  TotalLoads: "5"

 

Result - SharepointList2 = Reference:  "REF",   SubRef: "REF-01", 

                                                             "REF",   SubRef: "REF-02"

                                                             "REF",   SubRef: "REF-03"

                                                             "REF",   SubRef: "REF-04"

                                                             "REF",   SubRef: "REF-05"

 

Any advice would be appreciated, thank you.

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    You can create several records using this code.  Change the variable values as needed.

    Set(varReference, "REF");
    Set(varTotalLoads, 5);
    ForAll(
     Sequence(varTotalLoads),
     Patch(
     SharePointList2,
     Defaults(SharePointList2),
     {Reference: varReference, SubRef: varReference&"-"&Text(varTotalLoads,"00")}
     )
    )

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @mdevaney 

     

    This almost works, it created the records but the reference's are all the same. Example, I put 4 loads, each ref says the same "REF-04".

    How can I get this to increment from 01 until the maximum number, in this case 04? Here's my current code,

    Set(varReference, NewPopupConfirmationTextBox.Text);
    Set(varTotalLoads, Value(NewPopupTotalLoadsTextBox.Text));
    ForAll(
    Sequence(varTotalLoads),
    Patch(
    SubCons,
    Defaults(SubCons),
    {Confirmation: varReference, SubCon: varReference&"-" & Text(varTotalLoads,"[$-en-GB]00")})

     

    Thanks again for your help, very much appreciated.

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Change your Formula to the following:

    Set(varReference, NewPopupConfirmationTextBox.Text);
    Set(varTotalLoads, Value(NewPopupTotalLoadsTextBox.Text));
    ForAll(
     Sequence(varTotalLoads),
     Patch(SubCons, Defaults(SubCons),
     {Confirmation: varReference, 
     SubCon: varReference&"-" & Text(Value,"[$-en-GB]00")
     }
    )

    If you want to reference the Sequence number, you need to use Value.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes  @mdevaney 

    That worked, thank you both for your help.

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard