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 / Visibility using Or, o...
Power Apps
Answered

Visibility using Or, or ||

(0) ShareShare
ReportReport
Posted on by 79

Hi all!

 

I'm looking for a "cheat" if you will, on how to shorten the method I want to use to display something.

 

I have a label that I only want to appear if the words left, right, or both are selected in numerous comboboxes. I know this sounds strange, just bear with me here.

 

I was hoping that something like:

 

"Left" || "Right" || "Both" in combobox1.SelectedItems.Value

 

would work, but it only evaluates against "Both".

 

I'm aware I can type out something like:

 

"Left" in combobox1.SelectedItems.Value || "Right" in combobox1.SelectedItems.Value || "Both" in combobox1.SelectedItems.Value

 

and it would work perfectly, but as I stated above I have numerous comboboxes and am looking for an easier method to display this thing.

 

Any advice is appreciated!

Categories:
I have the same question (0)
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    If the selection mode in the combobox is single elements (SelectMultiple = false), then you can use this expression:

    ComboBox1.Selected.Value in ["Left", "Right", "Both"]

    If the combobox can have multiple selections, then you can use a combination of the ForAll and Sum functions to check whether the values are part of the selection or not:

    Sum(
     ForAll(
     ["Left", "Right", "Both"],
     If(Value in ComboBox1.SelectedItems.Value, 1, 0)),
     Value) > 0

    But at this point the expression is starting to get almost as complicated as the one that you have:

    "Left" in combobox1.SelectedItems.Value ||
    "Right" in combobox1.SelectedItems.Value ||
    "Both" in combobox1.SelectedItems.Value

    So it's up to you to decide which one you like the best 🙂

  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @i_reminisce

    In addition to  @CarlosFigueira's great examples, if the combobox has multiple selections, another method you can use is to combine the list of selected combobox values into a single string and to use a Regular Expression to search for a match.
    The syntax would look like this.

    IsMatch(Concat(ComboBox1.SelectedItems,Value & " ") ,
     ".*(Left|Right|Both).*"
    )

    Here's a link that explains the alternation expression in more detail:

    https://www.regular-expressions.info/alternation.html

  • i_reminisce Profile Picture
    79 on at

    Thanks for the awesome suggestions!

     

    My comboboxes in this case are just single choice, so your first method will at least save me a little bit of time!

     

    Also, thanks @timl for your idea, that can actually work for me down the road in this same app haha.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard