Hello,
I have screen1, screen2. I have a timer control on screen2 set to 60 seconds with repeat turned on. Ontimer end is set to Patch('datasource', Defaults('datsource'), EditForm1.Updates, EditForm2.Updates) and I also have a submit button on screen2 which kicks of a flow and also submits the item to sharepoint using the same patch function. Since trepeat is turned on, I see multiple entries created in sharepoint list and also final submit creates on more entry.
Is it possible to save everything in one sharepoint list item without multiple entries?
Thanks,
Solved! Go to Solution.
When you have `Defaults(datasourcename)` as the second parameter of the Patch function, it will always create a new record - which is why you're seeing many new records in your list.
If you want to have only one record auto-submitted (via the timer), you can store the current record to be stored in a variable, whose initial value would be `Defaults(datasourcename)` - so that the first time it will create a new record. But afterwards, you need to have that record that was created, so you'll be updating that record instead of creating a new one.
For example, in the OnVisible property of the first screen you can have the following expression:
Set(currentRecord, Defaults(datasourcename))
In the timer end, you can patch the current record - and update the current record with the result of Patch.
Set( currentRecord, Patch( datasourcename, currentRecord, EditForm1.Updates, EditForm2.Updates))
When you have `Defaults(datasourcename)` as the second parameter of the Patch function, it will always create a new record - which is why you're seeing many new records in your list.
If you want to have only one record auto-submitted (via the timer), you can store the current record to be stored in a variable, whose initial value would be `Defaults(datasourcename)` - so that the first time it will create a new record. But afterwards, you need to have that record that was created, so you'll be updating that record instead of creating a new one.
For example, in the OnVisible property of the first screen you can have the following expression:
Set(currentRecord, Defaults(datasourcename))
In the timer end, you can patch the current record - and update the current record with the result of Patch.
Set( currentRecord, Patch( datasourcename, currentRecord, EditForm1.Updates, EditForm2.Updates))
Hello @CarlosFigueira,
Thank you, that worked but whenever the timer ends after submitting the data to the sharepoint list its also clearing the existing text in the powerapps. Is there way to continue from the last word entered in the text field.
Not if you're using forms; when you use a form, and a data source is updated (i.e., in a Patch operation), then the form will take the result of the operation and make any updates that the server has - and will reset its fields to take those values.
You may be able to go avoid using forms (for an example, see this blog post by @Meneghino), but you will need to handle the updates yourself. You can also have several "checkpoints" where the user will initiate a save (Patch) operation, instead on relying on a timer to do that on the user's behalf.
I haven't tried setting the Item in the form to empty, so if it works for you, then great. The blog post gives you more control over the layout / data, with the drawback that you need to handle the changes yourself.
Remember, however, that many times you do want to get the updated item from the server after a Patch operation (when someone else edited the item, if there are any server-generated columns, etc), so ignoring the result from the server (which you will do if you set the item to blank) may lead to hard-to-find problems.
User | Count |
---|---|
213 | |
94 | |
87 | |
49 | |
38 |
User | Count |
---|---|
271 | |
104 | |
103 | |
60 | |
59 |