cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (5,401)