Skip to main content
Community site session details
Power Apps - Building Power Apps
Answered

Get last selection with ComboBox

Like (0) ShareShare
ReportReport
Posted on 18 Mar 2021 16:26:12 by 104

Hello the Community,

I would like get the last user selection of a combobox.

For example, in my Combobox, I have 3 items ["item1", "item2", "item3].
Firstly, the user selects "item1" and after "item2". Now, here I want display in a TextBox : "Your last selection is item1" (with a variable for example)


It works with a Dropdown and its onSelect property, but I need features of Combobox (mostly isSearchable and reset). So I can not use a Dropdown.


Could you help me ?

 

Bye.


Charlie.

Categories:
  • Verified answer
    Spamrancher Profile Picture
    345 on 18 Mar 2021 at 21:36:27
    Re: Get last selection with ComboBox

    I'm using the ComboBoxSample data that is structured like the image below. You'll need to adapt the code to fit the Items in your ComboBox.

    Spamrancher_0-1616103239461.png

     

    In the OnChange property of your ComboBox, enter:

     

    Collect(boxHistory, {value: Self.Selected, index: Last(boxHistory).index + 1})

     

    In your label/textbox, enter this for the Text property, where "Value1" is the field you want to display from the ComboBox.

     

    LookUp(boxHistory, index = Last(boxHistory).index - 1).value.Value1

     

     

    Result:

    Spamrancher_1-1616103458314.png

     

    Be sure to clear the collection at the appropriate time so it doesn't retain the history past where you want it to.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473