web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

List box unselect

(0) ShareShare
ReportReport
Posted on by 182

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

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @guyinkalamazoo 

    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.

  • guyinkalamazoo Profile Picture
    182 on at

    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

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @guyinkalamazoo 

    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.

  • guyinkalamazoo Profile Picture
    182 on at

    Thanks again.  This will work for me as I do not need anything preselected.  I just subbed to your channel too 🙂

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @guyinkalamazoo 

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard