Hi!
I'm using a collection for my gallery source and automatically saves changes when user is editing a column. Then I have a button outside my gallery that saves that collection to my datasource (SQL)
I'm using this method as it is much faster and smoother than ForAll with Patch. This took way too long and was annoying for the user.
Now I have a different issue that I'm trying to solve.
I've set my toggle OnChange to
Patch(
My_collection,
ThisItem,
{Column1: Value(Label1.Text),
Column2: Value(Label2.Text)
}
)
And my Defualt to:
ThisItem.Column1 <> Value(Label1.Text) ||
ThisItem.Column2 <> Value(Label2.Text)
This works great, however my Patch often starts before the user is able to complete the input. This Is fairly annoying.
Wondering if anyone has any solutions to this?
I've been considering maybe a timer, but not sure how to exactly implement that. Any other, hopefully easier ideas?
Thank you so much!
@Anonymous
Chances are that you were using your ForAll wrong and backward before. ForAll is a function that creates a table of records, it is not a ForLoop like in development languages. When used like a ForLoop in PowerApps, it almost always leads to performance issues.
In general, your save formula outside of the Gallery should be similar to this:
Patch(yourDataSource,
ForAll(yourGallery.AllItems,
{ID: ID, //or the name of your primary key to replace ID
Column1: Label1.Text,
Column2: Label2.Text
}
)
)
In your current scenario, you are not providing details about how and when you are storing the data to your datasource, only to collections. But, keep in mind that a lot of controls will perform their On... actions differently than might be expected and can lead to mysterious results.
I hope this is helpful for you.
User | Count |
---|---|
262 | |
110 | |
92 | |
55 | |
41 |