cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
noneother
Helper I
Helper I

I want my submitform to save to a collection instead of the original datasource

Hello

 

How would I save my form to a collection instead of back to the original datasource?

 

I tried collect(exampleCollection,submitform(form1)); and it doesn't seem to work. Any other methods?

5 REPLIES 5
WarrenBelz
Super User III
Super User III

Hi @noneother ,

You cannot display an item from a collection on a form, however this will get you all the fields on the form that have been changed

ClearCollect(colForm,YourFormName.Updates)

Or you could simply code it all

ClearCollect(
   colForm,
   {
      Field1Name:FormControl1.xxxx
      Field2Name:FormControl2.xxxx
      Field3Name:FormControl3.xxxx
   }
)

the xxxx is what ever valid value refers to the control content.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

This doesn't seem to work for me, below. I want to simultaneously save to a collection then save that collection to the respective record within a SharePoint list. Any clues?

 

ClearCollect(ColForm1Form2,{Col_ACMPS_CARE_RECIPIENT_ID: DataCardValue146.Text, 'Activity Notes': DataCardValue25.Text});

ForAll(
          ColForm1Form2,
          Patch(
              LookUp('Consumer Sample for Survey FINAL', Col_ACMPS_CARE_RECIPIENT_ID = ACMPS_CARE_RECIPIENT_ID),
                     {

'Activity Notes': ColForm1Form2[@'Activity Notes']

                     }
          )
);

 

Nevermind. I saw I was missing: the source before Lookup

 

 

ClearCollect(ColForm1Form2,{ACMPS_CARE_RECIPIENT_ID: DataCardValue146.Text, 'Activity Notes': DataCardValue25.Text});

ForAll(
          ColForm1Form2,
          Patch(
              'Consumer Sample for Survey FINAL', LookUp('Consumer Sample for Survey FINAL', ColForm1Form2[@ACMPS_CARE_RECIPIENT_ID] = ACMPS_CARE_RECIPIENT_ID),
                     {

'Activity Notes': ColForm1Form2[@'Activity Notes']

                     }
          )
);

 

Hi @noneother ,

Are you waiting to also retain all the notes in the collection?

You need to firstly initiate it - App OnStart would work - this will give you an empty collection with the required fields

ClearCollect(
   ColForm1Form2,
   {'Consumer Sample for Survey FINAL':""|,
   {'Activity Notes': ""}
);
Clear(ColForm1Form)

Then you can collect all the form inputs

Collect(
   ColForm1Form2,
   {
      ACMPS_CARE_RECIPIENT_ID: DataCardValue146.Text, 
      'Activity Notes': DataCardValue25.Text
   }
)

Then when you want to write it all back

ForAll(
   RenameColumns(
      ColForm1Form2,
      "ACMPS_CARE_RECIPIENT_ID"
      "ACMPS_ID"
      "Activity Notes",
      "Activity",
   ),
   Patch(
      'Consumer Sample for Survey FINAL', 
      {ACMPS_CARE_RECIPIENT_ID:ACMPS_ID};
      {'Activity Notes':Activity]
   )
)

Is this what you want to do - or do you want to write each, but store in a collection as well? The first bit (OnStart) and the collection would be the same. The Patch would be

Patch(
   'Consumer Sample for Survey FINAL', 
   {ACMPS_CARE_RECIPIENT_ID: DataCardValue146.Text},
   {'Activity Notes': DataCardValue25.Text}
)

or

UpdateIf(
   'Consumer Sample for Survey FINAL', 
    ACMPS_CARE_RECIPIENT_ID=DataCardValue146.Text,
   {'Activity Notes': DataCardValue25.Text}
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @noneother ,

It seems that you've solve your problem, am I right?
If so, do you have any other problem?

If not, could you change your issue's status to "Answered"?

Thanks!

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,491)