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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / UpdateContext to chang...
Power Apps
Answered

UpdateContext to change Gallery.Selected.Name

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi there. 

 

I have created an app that is being used for tracking service calls outside office hours. 

The app is working already, but i have recieved a request to change how you pick a client. 

 

Currently i am using a dropdown for clients. 

But with a lot of clients (200+), it becomes a lot of swiping to get to the buttom. 

 

To combat this, I have created a gallery with all our clients where you can search the name - a lot faster. 

 

The problem i am having is that I can't seem to clear the selected name
OnSelect: Navigate(Indberetning;ScreenTransition.Fade;{AccountnameNEW:AssignToGallery_3.Selected.Name})

 

from the label I am using as a button AND to show selected "AccountnameNEW".

 

I have been trying to use a UpdateContext to assign it's value to blank when pressing Button1. 

UpdateContext({AccountNameNEW:""});;
UpdateContext({AssignToGallery_3:""});;
UpdateContext({label12_1:""})

 

None of these work, so the last used Accountname won't reset when creating next ticket. You can still pick another Accountname, but it's just not aesthetically pleasing.

 

What am I doing wrong? 

I can get the UpdateContext to work on textinputs, but I can't seem to get it working for a label. 

Categories:
  • eka24 Profile Picture
    20,925 on at

    Once the app is already working, and the only thin now is

    "Currently i am using a dropdown for clients.

    But with a lot of clients (200+), it becomes a lot of swiping to get to the buttom"
    Kindly replace the Dropdown with a Combobox, it has the searching capabilities. You can always clear the name and enter a new one for the search.

     

    Knowing your formula for the Gallery could help, but generally to filter a Gallery, try this on the Items Property:

    Filter(YourTableName, ColuumName=ComboboxName.Selected.Value)

    or

    Filter(YourTableName, ComboboxName.Selected.Value in YourColumnName)
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you want to change the value of "AssignToGallery_3.Selected.Name" by using a variable?

    I'm afraid it's not supported to do this.

    Formula like this "UpdateContext({AccountNameNEW:""})" only changes the variable value. It will not affect the value of "AssignToGallery_3.Selected".

    The value of "AssignToGallery_3.Selected" could only be decided by the action of "select" in the gallery.

    So there's only two ways to change this value:

    1)select another item in the gallery

    2)reset the gallery

    Please notice that "AssignToGallery_3.Selected" can not be blank value.

    Since you just want to clear the value of the last selected item, not choose another item, I suggest you use the second solution.

    Resetting the gallery could make the value of "AssignToGallery_3.Selected.Name" change back to the gallery's default selected item. And the gallery's default selected item is decided by its Default property.

    If you do not use any formula in its default property, the first item will be the gallery's default selected item.

    If you set one specific item in the gallery's default property, that item will be the gallery's default selected item.

     

    Try this:

    1)the formula of creating the variable:

    Navigate(Indberetning;ScreenTransition.Fade;{AccountnameNEW:AssignToGallery_3.Selected.Name})

    2)clear the value of the last selected item, set the label's OnSelect:

    Reset(AssignToGallery_3)

    Then the the last selected item's value will be cleared, "AssignToGallery_3.Selected.Name" will become the first item's Name.

    If you want the gallery.Selected default value is one specific item, you could set the gallery's Default to this item like this:

    LookUp(...,Name=....)

    Then using Reset()function will make the value of "AssignToGallery_3.Selected.Name" become this item's Name value.

     

     

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard