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 / How to reference a dro...
Power Apps
Answered

How to reference a dropdown item

(0) ShareShare
ReportReport
Posted on by 353

Hello,

 

If i have a dropdown consisiting of string items, ex: ["hi", "bye"], then i have a label that shows me if i have selected hi, If(dropdown.SelectedText.Value = "hi", true, false). This works, output will be true. But instead of hardcoding the string, can we reference the items in the dropdown as array indexes ? 

 

Thanks

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @mmattar 

    Yes, you can check to see if the dropdown equals the first value within the dropdown.  We can check for the 1st position Item using the FIRST function.  It's not an array index but it works!

     

    If(
     Dropdown.SelectedText.Value= First(["hi","bye"]),
     true,
     false
    );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

     

  • mmattar Profile Picture
    353 on at

    how about if we want to see if the 2nd,3rd, or 4th item was selected ? 

  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @mmattar 

    You would select the 2nd item like this.

     

    If(
     Dropdown.SelectedText.Value= Last(FirstN(["hi","bye","wow","ohno"],2)).Value,
     true,
     false
    );

     

    And the 3rd item like this

     

    If(
     Dropdown.SelectedText.Value= Last(FirstN(["hi","bye","wow","ohno"],3)).Value,
     true,
     false
    );

     

    And the 4th Item like this...

     

    If(
     Dropdown.SelectedText.Value= Last(FirstN(["hi","bye","wow","ohno"],4)).Value,
     true,
     false
    );

     

    Let me know if you have further questions.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

    Hi @mmattar ,

    Could you please share a bit more about your scenario?

    Do you want to reference the Items option within the Dropdown box as array index rather than hardcoding the string?

     

    I have made a test on my side, pleae take a try with the following workaround:

    1. Reference first item option:

    If(dropdown.SelectedText.Value = Last(FirstN(["Option1", "Option2", "Option3", "Option4", ...], 1)).Value, true, false)

    2. Reference second item option:

    If(dropdown.SelectedText.Value = Last(FirstN(["Option1", "Option2", "Option3", "Option4", ...], 2)).Value, true, false)

    3. Reference third item option:

    If(dropdown.SelectedText.Value = Last(FirstN(["Option1", "Option2", "Option3", "Option4", ...], 3)).Value, true, false)

    4. Reference forth item option:

    If(dropdown.SelectedText.Value = Last(FirstN(["Option1", "Option2", "Option3", "Option4", ...], 4)).Value, true, false)

    ...

    ...

     

    Please take a try with above solution, then check if the issue is solved.

     

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard