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

Advice on updating from SharePoint lists

Morning all,

 

I am in a bit of quandry. My app connects to a number of SharePoint lists that perform lookups against inputted data. For example, someone says they manage 25 clients, and for these clients chooses category A. Category A means that according to the Sharepoint lookup table, for every client, you are given 1 hour of work, plus 1 hour for preparation. That means that the final number of hours assigned to that person, and what is uploaded to my database, is 50. I would also upload the Category chosen, and quantity of 25 to represent the clients. 

 

So, now my problem. I am expecting to have to revise the SharePoint Lists fairly soon, and change some of the calculations. So in the above example, the calculation might now say for every client you get 1 hours plus 0.5 hours for preparation. I will need to cascade these changes to all existing records.

 

I'm thinking that pulling all my records into Powerapps and then running a fresh patch on them might work, but I'm not sure. Can you guys think of any way that I could get these changes to all the already uploaded records?

 

Cheers,

 

Matt

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Advice on updating from SharePoint lists

Hi @EpicTriffid ,

Could you please share a bit more about your scenario?

Do you want to update all existing records in your SP List to apply the new Calculation rule?

 

Based on the needs that you mentioned, I think UpdateIf function could achieve your needs. Please consider set the OnSelect property of a "Update" button to following:

UpdateIf(
         'Your SP List',
         true,
         {
            TotalHour: Quantity * 1.5
         }
)

Note: The TotalHour represents the column in your SP list to store the total hours assigned to that user. The Quantity represents the column in your SP List to store the quantity of clients for each user. Please replace them with actual column name in your SP List

 

In addition, you could also consider achieve your needs using ForAll function and Patch function, please take a try with the following formula (set the OnSelect property of a "Update" button to following):

ForAll(
       RenameColumns('Your SP List', "ID", "ID1"),
       Patch(
             'Your SP List',
              LookUp('Your SP List', ID = ID1),
              {
                  TotalHour: Quantity * 1.5
              }
       )
)

 

Please take a try with above solution, then check if the issue is solved.

 

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.

View solution in original post

4 REPLIES 4
Highlighted
Community Champion
Community Champion

Re: Advice on updating from SharePoint lists

Try:

Patch( YourList, First( Filter( YourList, ColumnName = "1" ) ), { ColumnName : "1.5" } )

 

You can also read this post if it does not work

https://powerusers.microsoft.com/t5/Building-Power-Apps/Update-Sharepoint-list-by-incrementing-value...

 

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Highlighted
Helper II
Helper II

Re: Advice on updating from SharePoint lists

Hi @eka24 ,

 

Thankyou for the suggestion, but I'm not sure if changing the SP list itself would cascade those changes through all current records in my database, unless im wrong?

Highlighted
Community Champion
Community Champion

Re: Advice on updating from SharePoint lists

My understanding is that wherever you see 1, change it to 1.5

in that column. if that is the case, the reply would work.

Highlighted
Community Support
Community Support

Re: Advice on updating from SharePoint lists

Hi @EpicTriffid ,

Could you please share a bit more about your scenario?

Do you want to update all existing records in your SP List to apply the new Calculation rule?

 

Based on the needs that you mentioned, I think UpdateIf function could achieve your needs. Please consider set the OnSelect property of a "Update" button to following:

UpdateIf(
         'Your SP List',
         true,
         {
            TotalHour: Quantity * 1.5
         }
)

Note: The TotalHour represents the column in your SP list to store the total hours assigned to that user. The Quantity represents the column in your SP List to store the quantity of clients for each user. Please replace them with actual column name in your SP List

 

In addition, you could also consider achieve your needs using ForAll function and Patch function, please take a try with the following formula (set the OnSelect property of a "Update" button to following):

ForAll(
       RenameColumns('Your SP List', "ID", "ID1"),
       Patch(
             'Your SP List',
              LookUp('Your SP List', ID = ID1),
              {
                  TotalHour: Quantity * 1.5
              }
       )
)

 

Please take a try with above solution, then check if the issue is solved.

 

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.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

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 (11,747)