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 / Set Variable from drop...
Power Apps
Answered

Set Variable from drop down

(0) ShareShare
ReportReport
Posted on by 79

Hi All,

 

Trying to set a variable when a drop-down value is equal to no I have the below on the drop downs "OnSelect" the drop down itself is also a variable "var_dropdown"

 

If(dropdown.SelectedText = "No"),Set(var_output , "TEXT")

 

Any suggestions would be greatly appreciated

Categories:
  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @Mclean2023 

    You can try to use this  code:
    If(dropdown.SelectedText.Value = "No",Set(var_output , "TEXT") )

     

    The ".Value" is the column Name in your dropdown control - items columnName;For example , if my items column Name is "Col1", i need to use this expression:
    If(dropdown.SelectedText.Col1= "No",Set(var_output , "TEXT") )

    vyueyunmsft_0-1716429768366.png

     

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

  • Mclean2023 Profile Picture
    79 on at

    HI Yueyun

    PERFECT, thank you so much for your help and quick reply,

    If(dropdown.SelectedText.Value = "No",Set(var_output , "TEXT") ) worked. once i moved it to "on change" and not "on select"

  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @Mclean2023 

    Yes , you need to put this code to "OnChange" property which means Actions to perform when the user changes the value of a control (for example, by adjusting a slider).

    Drop down control in Power Apps - Power Apps | Microsoft Learn

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

  • Verified answer
    Mclean2023 Profile Picture
    79 on at

    need to make small update on this, need another option. When i update the formula, I don't get an error, but nothing happens when running it. the first part still works by adding no but if I change the drop down to yes, the no stays in the field.

     

    If(dropdown.SelectedText.Value = "No",Set(var_output , "TEXT_1") ||

    If(dropdown.SelectedText.Value = "Yes",Set(var_output , "TEXT_2") ||

    If(dropdown.SelectedText.Value="N/A",Set(var_output ,Blank())))

  • Verified answer
    MuhammadAizaz Profile Picture
    53 on at

    Hello @Mclean2023 ,

    Here is the tested code for the onChange property of Dropdown box.

    Please let me know if it works.

     

    If(Dropdown1.Selected.Value = "Yes", Set(var_output, "Text_1"),
    Dropdown1.Selected.Value = "No", Set(var_output, "Text_2"),
    Dropdown1.Selected.Value = "N/A", Set(var_output,Blank()))
     
  • Mclean2023 Profile Picture
    79 on at

    Thank you so much, that worked perfectly

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 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard