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

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
Highlighted
Community Support
Community Support

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.
Highlighted
Helper I
Helper I

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.

 

 

Highlighted
Community Support
Community Support

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

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,996)