cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft
Microsoft

Total points

Hi, 

 

I'm building a Power App where there is a list of activities worth different points and users can click buttons to add and remove an activity depending on whether they've done it and it will total their points. 

 

I have a SharePoint list called 'GoGreenActivities' with a list of activities and corresponding points. 

 

I have put in this formula into the 'OnSelect' of the Add button: 

UpdateContext({Total:Total + Value(LookUp('GoGreenActivities',Title="ThisItem.Title",Points))})

 

and this formula into the 'OnSelect' of the Remove button: 

UpdateContext({Total:Total - Value(LookUp(GoGreenActivities,Title="ThisItem.Title",Points))})

 

Then I have just a text label that says 'Total' and according to this doc Using this doc: Button control: reference - Power Apps | Microsoft Docs  when the buttons are pressed it should work but it doesn't. If I just put UpdateContext({Total:Total + Value(1)}) for example, it does work and the total box adds and removes 1 but it seems to have trouble looking up the point value from my SP list. 

 

Can anyone help? 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @BT168 ,

Is your Points field in GoGreenActivities a Numeric field - if so you should just need this

With(
   {   
      wPoints:
      LookUp(
         GoGreenActivities,
         Title=ThisItem.Title
      ).Points
   },
   UpdateContext(
      {Total:Total - wPoints}
   )
)
  

 

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.

View solution in original post

2 REPLIES 2
Super User III
Super User III

Hi @BT168 ,

Is your Points field in GoGreenActivities a Numeric field - if so you should just need this

With(
   {   
      wPoints:
      LookUp(
         GoGreenActivities,
         Title=ThisItem.Title
      ).Points
   },
   UpdateContext(
      {Total:Total - wPoints}
   )
)
  

 

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.

View solution in original post

Super User III
Super User III

Hi @BT168 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (50,085)