I have a functional repeating section that saves the values to SharePoint list.
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
}
) )
)
)
Solved! Go to Solution.
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.
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.
Moving + outside the repeating section, as per your instruction, fixed the issue. Thank you.
User | Count |
---|---|
254 | |
106 | |
92 | |
47 | |
37 |