Looking for a little help with this one.
Onselect of a submit button everything gets submitted all but last item from the collection. Attached is the formula I'm using for the submit button.
Does anyone have a fix for this?
Hello @mperez84 ,
How do you form the variable downingid and what is the field type in the data source?
A few things to note from your screenshot.
I recommend that you disambiguate the columns in your collections, to ease writing functions against them. For example, when you collect into Collection1, use something like 'appDowningId' instead. Then, when you're writing your Patch function in the ForAll, it will be much clearer when you're referencing that column or the destination's column.
Speaking of which, is the column in the SharePoint list actually downingid - why aren't you referencing the display name like the 'Trade Show Title' column?
Thanks @mperez84 ,
So downingid is a text field in Collection1 and you are patching this together with a static value from your screen as new records to a data source with a ForAll looping through the collection and it does not Patch a valid value.
The first thing I would suggest you try is as suggested by @GarethPrisk and rename the field in the collection to something else.
We can continue from there between us if that does not solve the issue.
Hi @mperez84 ,
Do you mean that the downingid field hasn't been updated successfully?
If so, I notice that you have the same field name in the collection and the list, which may lead some problems.
I suggest you use [@] to avoid ambiguity.
Try this formula:
ForAll(Collection1,Patch('Asset Request',Defaults('Asset Request'),{'Trade Show Title':DataCardValue1.Text,downingid:Collection1[@downingid]}))
Best regards,
I've changed the reference name from downingid to appdowningid, that didn't fix it. I found when I removed from the onselect button formula the clear(collection1) the issue goes away. But then obvious happens, when I select new form the previous selected data is there.
Is there another way to clear the collection after submit?
When you say 'submit', are you referring to?
The ForAll function will loop through and create/update a record per row in Collection1 via the Patch function.
The SubmitForm function will causes that form to submit to the database. You can hook into it's OnSuccess action to perform another action, such as clearing Collection1.
What is SharePointForm1 connected to? What are you submitting via that?
Can you review/confirm Collection1 prior to the ForAll patch, to ensure all columns have data?
Hey @GarethPrisk
Yes sorry ''submit'' is just the reference name to my button.
The Sharepointform1 is connected a sharepoint list named "Asset Request". This is where the collection and trade show title text field is being written back too.
I've confirmed all the data during collection is there prior to the patch.
removing the clear(collection1) from the ForAll/patch function causes all the columns to write appropriately.
I'm not sure where else to try the clear collection function at. Ideally I would like this to be a single onselect button function.
Okay, to clarify something real quickly:
The way your formula was written in the original screenshot indicates:
How are you collecting into Collection1?
Should you be creating a list of records, and then creating/updating another/an existing record as well?
User | Count |
---|---|
201 | |
101 | |
90 | |
45 | |
43 |
User | Count |
---|---|
247 | |
105 | |
103 | |
65 | |
58 |