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 Apps
Answered

Repeating section

(0) ShareShare
ReportReport
Posted on by 240

I have a functional repeating section that saves the values to SharePoint list.

nemanjasovic011_1-1659459798051.png

The issue is that I have to click '+' icon to populate the collection initially, otherwise - the collection is empty and nothing gets written to SharePoint when I click 'RPS_Test' button(submission to SharePoint). This will confuse the users. I am trying to avoid having to clicking the '+' to save the values in collection so that they can be pushed to SharePoint  IF the values are populated.  

 

Plus button has the following code:

Patch(
 RepeatingSection,
 ThisItem,
 {
 BottleSize123: BottleSizeMultiselect_2.Selected.Result,
 UPCComboBox:UPCComboBox2.Selected.Result,
 Other1:BottleSizeOtherRPTNEW.Text,
 Other2:UPCOtherRPC.Text
 
 }
);
Collect(
 RepeatingSection,
 {
 BottleSize123: "",
 Bottlesize2: "",
 Other1: "",
 Other2: ""
 }
);

RPS test button has the following code:

ForAll(
 RepeatingSection,
 If(
 !IsBlank(BottleSize123),
 (Patch(
 'Bottle Size UPS RS',
 Defaults('Bottle Size UPS RS'),
 {
 Title: "test",
 IDFK: 1,
 BottleSize: BottleSize123,
 BottleSizeOther: Other1,
 UPCOther: Other2,
 UPC: UPCComboBox
 }
 ) )
 )
)

 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @nemanjasovic011 

    You user interface is a little confusing then...you have a Plus (Add) icon in the row with the record you are editing.  Wouldn't it be less confusing to have a plus icon outside of the row - either on a blank row under any current ones or outside of the gallery?

     

    Also, your ForAll is used backward.  You are using it like a For Loop in some development platform which PowerApps is not.  ForAll is a function that creates a table of records.  That can then be supplied to the Patch.  The way you have it currently, your app will have to instantiate a patch on each iteration rather than just once.  This will impact your performance greatly.

     

    You are not mentioning how you are filling your collection, but in general, you need to not worry about all of that.

     

    Concept is this:

    - First, a collection used for the gallery.  That collection can be populated with a Filter of records from your datasource.  Or if you are always starting with no records, then it need not be created at all.

     

    - Next, a "Plus/add" icon outside of the gallery that simply does the following:

    Collect(RepeatingSection, Defaults('Bottle Size UPS RS'))

    This will then show a new row in your gallery.

     

    - Finally, your button to submit the records should be based on your Gallery...not the collection.

    It would be more like this:

    Patch('Bottle Size UPS RS',
     ForAll(
     Filter(yourGallery.AllItems, !IsBlank(BottleSize123InputControlName.<text/value/etc>)),
     {
     ID: ID,
     Title: "test",
     IDFK: 1,
     BottleSize: BottleSize123InputControlName.<text/value/etc>,
     BottleSizeOther: BottleSizeOtherInputControlName.<text/value/etc>,
     UPCOther: UPCOtherInputControlName.<text/value/etc>,
     UPC: UPCInputControlName.<text/value/etc>
     }
     ) 
    )

     

    That is all you need.  

     

    I hope this is helpful for you.

  • nemanjasovic011 Profile Picture
    240 on at

    Moving + outside the repeating section, as per your instruction,  fixed the issue. Thank you.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 477

#2
WarrenBelz Profile Picture

WarrenBelz 341 Most Valuable Professional

#3
11manish Profile Picture

11manish 317

Last 30 days Overall leaderboard