I have a few different listbox controls whose items are from a SharePoint list. Each item has a numerical score associated with it. When the end user selects an item, it is easy to set a global variable to that accumulated value (for each selected). But if they unselect an item is there a simple way to subtract that score from the cumulated value. I did not see an unselect function for a listbox. How might I be able to do this? Thanks for the advice
Solved! Go to Solution.
You really don't need to do any variable setting for the control. It already has the list of items selected that you want.
If you refer to the SelectedItems of the list box, it will contain anything selected. It will always reflect what is selected in the list.
Setting a variable for this would be very "program-like" and PowerApps is not a development platform. So consider just referencing the control in your app.
Ex. Listbox1 on the screen with the appropriate Items property.
To see the selected...(as an example) put another list box on the screen and set the Items property to Listbox1.SelectedItems
I hope this is helpful for you.
You really don't need to do any variable setting for the control. It already has the list of items selected that you want.
If you refer to the SelectedItems of the list box, it will contain anything selected. It will always reflect what is selected in the list.
Setting a variable for this would be very "program-like" and PowerApps is not a development platform. So consider just referencing the control in your app.
Ex. Listbox1 on the screen with the appropriate Items property.
To see the selected...(as an example) put another list box on the screen and set the Items property to Listbox1.SelectedItems
I hope this is helpful for you.
Yes, this is very helpful and I am hoping I can wrap a Sum() around the lb.SelectedItems. That would be perfect. Thanks for the information
Yes, you can...
ex. Sum(lb.SelectedItems, someValue)
Just keep one thing in mind about list boxes - you CANNOT automatically select items in the list. This is a long running issue about Listboxes and very annoying if you want to use one to display some values that are in some datasource.
Not sure if that is a factor for you going forward, but wanted to point it out.
Thanks again. This will work for me as I do not need anything preselected. I just subbed to your channel too 🙂
Good deal...then the Listbox will do the trick.
And thanks for subbing to the channel!! I am really behind on posting videos, but have it on my schedule before year end.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
177 | |
52 | |
41 | |
36 | |
27 |
User | Count |
---|---|
243 | |
81 | |
71 | |
69 | |
66 |