0

I'm using a simple collection function to collect values for four columns of my list and I'm using a data table to show those values from the collection. This works fine and table shows the values I enter. I'm then using a Submit button to patch the records to my list and this seemingly works.

However, when I go to the list, I see only the last item that I entered in the collection and every other record I created, it shows values of the last item only. When I go to the File tab on PowerApps and go to Collection, it shows the distinct values I've entered but then the same values get overwritten by the last record. For eg. I create 3 records and even if SPO list shows 3 new records created, it shows the values of the 3rd record even on 1st and 2nd record.

Below is code I've used to patch the records.

ForAll(NewtestCol,Patch('VDI Request Form',Defaults('VDI Request Form'), {'Region & Domain': RegionDomain1.Selected,'Domain UID': DomainUID1.Text,'Requesting For': RequestingFor1.Text,'Request Number': RequestNumber.Text })

1 Answers1

0

you do understand, you are doing ForAll based on your Newtestcol

but you are patching i.e creating records with values from RegionDomain1.Selected or DomainUID1.Text

Are your RegionDomain1 or DomainUID1 coming from collection Newtestcol? or are they coming from Textbox or combobox or so on?

AnkUser
  • 5,421
  • 2
  • 9
  • 25
  • Yes, RegionDomain1 and DomainUID1 are textboxes which are being used in the Newtestcol collection. Here's the code I use on the Load button to load the entries one after another and show them in a table below the Load button. Collect( NewtestCol, { 'Col_Region & Domain': RegionDomain1.Selected, 'Col_Domain UID': DomainUID1.Text, 'Col_Requesting For': RequestingFor1.Text, 'Col_Request Number': RequestNumber.Text } ) – Prabhat Singh Sep 05 '22 at 10:29
  • Sorry for the fudged code: `Collect( NewtestCol, { 'Col_Region & Domain': RegionDomain1.Selected, 'Col_Domain UID': DomainUID1.Text, 'Col_Requesting For': RequestingFor1.Text, 'Col_Request Number': RequestNumber.Text } )` – Prabhat Singh Sep 05 '22 at 10:39
  • so does your collection NewTestCol has unique rows i.e each row has different values. I would suspect and check/debug what does your NewTestCol shows. [Take a look at this article how to debug](https://powerapps.microsoft.com/en-us/blog/canvas-debugging-with-results-view/) – AnkUser Sep 05 '22 at 13:49
  • Region & Domain and Request Number might have same values for multiple rows. Domain UID and Requesting For column would have unique values for every row for every time someone submits the form. As for what NewTestCol shows, it shows the correct values on the Collections tab within PowerApps edit screen. That's why I'm perplexed that why does it duplicate the value upon calling the For All and Patch functions. – Prabhat Singh Sep 06 '22 at 05:32