cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Amghost
Level: Powered On

Update Existing Collection Prior to Writing to Sharepoint

Scenario:

I have a three part form/process on a single page.

Top of Form:

>User Inputs a number of text fields.

>User Clicks "Add to worksheet" which adds to the gallery below and clears the fields so they can add additional items.

Middle of Form:

>Simple galleries (2) that show the data they entered above.

Bottom of Form:

>User must complete an explanation (Rich Text).

 

I then have a Button that uses:

ForAll(Collection, Patch(SharepointList, Defaults(SharepointList), { xxx:xxx, xxx:xxx}))

***However, I want to also add the explanation to the sharepoint list when the button is hit, but it is not in the collection.  After all the data (Gallery and collection) is posted to the list, I want to clear everything and navigate to a page that displays the data from the list for Approval Routing.

 

I am trying:

xxxxx})); Collect(Collectxxx, Patch(xxxxx, Defaults(xxxxx), {Explanation: Explanation}),Clear(CollectAdjustDetail))

 

That is not working.  Need ideas....

 

 

3 REPLIES 3
Community Support Team
Community Support Team

Re: Update Existing Collection Prior to Writing to Sharepoint

Hi @Amghost ,

Could you please share a bit more about your scenario?

Do you want to update the explanation text into your collection before patching data into your SP list?

Further, is there a "Explanation" column existed in your collection already? How do you collect data into this collection in your app?

 

I assume that there is a "Explanation" column existed in your collection already, if you want to update the explanation text into your collection before patching data into your SP list, please take a try with the following workaround:

Set the OnSelect property of the "Submit" button to following:

 

UpdateIf(Collection, true, {Explanation: RichTextEditor1.HtmlText});  /* <-- Add formula here. Update the "Explanation" column in your collection with the Rich Text value */
ForAll(
Collection,
Patch(SharepointList, Defaults(SharepointList), { xxx:xxx, xxx:xxx})
);
....

Note: Please make sure you have defined a "Explanation" column in your collection to store the Rich text value.

 

 

More details about the UpdateIf function, please check the following article:

UpdateIf function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Amghost
Level: Powered On

Re: Update Existing Collection Prior to Writing to Sharepoint

There is not an explanation in the collection as that is not added until after the initial data is in the collection.  The explanation is added after the user confirms that data entered initially at the top of the form.  I do have an explanation column in the SP list.

 

 

Community Support Team
Community Support Team

Re: Update Existing Collection Prior to Writing to Sharepoint

Hi @Amghost ,

Do you want to add a new 'Explanation' column into your collection along with proper Rich Text value before patching data into your SP List?

Why not patch explanation data to your SP List directly?

 

If you want to add a new 'Explanation' column into your collection along with proper Rich Text value before patching data into your SP List, I afraid that there is no way to achieve your needs in PowerApps currently.

Note: The AddColumns function would return a temporary table, rather than modify the underlying table (on your side, it is the collection)

 

As an alternative solution, you could consider patch the explanation data to your SP List directly. Please consider modify your formula as below:

ForAll(
Collection,
Patch(
SharepointList,
Defaults(SharepointList),
{
xxx:xxx,
xxx:xxx,
Explanation: RichTextEditor1.HtmlText /* <-- Assign Explanation value to the Explanation column dirctly */
}
)
);
.... 

 

Best regards,

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 347 members 6,771 guests
Please welcome our newest community members: