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

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

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.

 

Highlighted
Helper I
Helper I

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

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']

                     }
          )
);

 

Highlighted
Helper I
Helper I

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

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']

                     }
          )
);

 

Highlighted
Community Champion
Community Champion

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

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.

Highlighted
Community Support
Community Support

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

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,095)