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?
Solved! Go to Solution.
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.
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.
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.
User | Count |
---|---|
194 | |
123 | |
87 | |
48 | |
40 |
User | Count |
---|---|
276 | |
165 | |
139 | |
80 | |
76 |