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 Platform Community / Forums / Power Apps / Onselect radio button ...
Power Apps
Unanswered

Onselect radio button , reset gallery.selected

(0) ShareShare
ReportReport
Posted on by 321

I have a radio button with option1 and option2.
And there is a text label, option1 returns my name by default, and there is a gallery that appears when you press option2, and if you select a colleague's name from a gallery with employee information, the colleague's name is returned from the text label.


In this case, when the option 1 is pressed again, I want to reset the selected gallery information.
So I wrote a code to reset the gallery if I choose radio option 1 because the gallery doesn't have a reset property. However, this does not execute, although there is no error. Is there any other way?

 

It says that this formula causes unintended consequences and is therefore not calculated.

 

Bingqiling_0-1701246380987.png

 

Categories:
I have the same question (0)
  • MudassarSZ365 Profile Picture
    591 on at

    Hi @Bingqiling ,

    set a veriable on the onstart property of the app

    Set(varSelectedGalleryItem, Blank())

     

    Bind the Variable to the Gallery: Use this variable to track the selected item in the gallery.

    Default = varSelectedGalleryItem

    Radio Button OnSelect: When the radio button for option 1 is selected, set the variable back to blank.

    If(Radio1.Selected.Value = "option1", Set(varSelectedGalleryItem, Blank()))

    Label Text: The label which shows the name should have a formula based on the selected item in the gallery or the default name when the variable is blank.

    Text = If(IsBlank(varSelectedGalleryItem), "My Name", Gallery1.Selected.EmployeeName)

    If this information helps you resolve your query, please mark it as the solution and leave a thumbs up. Thank you! 😊

     

  • Bingqiling Profile Picture
    321 on at

    I tried the method you suggested
    Gallery is not initialized,
    When you click Option 2 on the radio button again to select a colleague from the gallery, the colleague's name is not returned.

  • Bingqiling Profile Picture
    321 on at

    hi @MudassarSZ365 

    The part that I couldn't say
    When you select a colleague in the gallery, do you use textinput controls to search and make a selection, does this affect you?? When radio button option 1 is pressed, should this textinput be reset?

  • MudassarSZ365 Profile Picture
    591 on at

    @Bingqiling ,

    set this veriable on the onstart property of the app

    Set(varSelectedGalleryItem, Blank());

    set this on the default property of the gallery

    varSelectedGalleryItem

    put this code on the onselect property of the radio

    If(
     Radio1.Selected.Value = "option1", 
     Set(varSelectedGalleryItem, Blank());
     Reset(TextInputSearch);
    )

    put this code on the onselect property of the gallery

    Set(varSelectedGalleryItem, ThisItem);

    put this code on the text property of the text label

    If(
     IsBlank(varSelectedGalleryItem), 
     "My Name", 
     varSelectedGalleryItem.EmployeeName
    )

    If it helps, remember to mark the solution and leave a thumbs up. Thank you!

     

     

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard