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 / Dropdown selection onl...
Power Apps
Answered

Dropdown selection only gets added when correct option is selected

(1) ShareShare
ReportReport
Posted on by 242

JeckGill_0-1693401356991.png

Hey all,

I was hoping to get a second thought on this - I think I may be going about it wrong (the red lines aren't showing in the screenshot but they are screaming at me).

 

What this post is for mainly is I want to this page set up so that when the user selects either option 1 or 2, the title of that row gets ClearCollected into it's own collection. "Dropdown1" is the label for the dropdown, and the row titles are taken from a different collection so they simply use "ThisItem.Title". If any more information is required feel free to ask 🙂

 

I have 4 more similar pages; my plan is to have a clear collect on each page, then mash them into one big collection to be used in a gallery on the last page (but that's a problem for me to solve later, unless anyone has any ideas on whether or not that would work)

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @JeckGill 
    Your existing formula has a couple of issues:

    1. The Or function is case-sensitive and should be spelled as Or and not OR.
    2. The third argument in the Or function is a ClearCollect operation, which is misplaced. Or is a logical function that should only contain boolean expressions as arguments.

    Here is how you should fix it:

    If(
     Or(Dropdown1.Selected.Value = "1", Dropdown1.Selected.Value = "2"),
     ClearCollect(
     colRatedWelfare,
     {
     RatingTitle: ThisItem.Title
     }
     )
    )
    

    This formula uses an If function to check the condition.

    If Dropdown1.Selected.Value is either "1" or "2", it should then execute the ClearCollect function to add the current row title to colRatedWelfare. 

    See if this helps @JeckGill 

  • JeckGill Profile Picture
    242 on at

    I'm still getting red lines - but I think I have an idea why... My Dropdowns use a global value

    JeckGill_0-1693405115353.png


    is there a certain way I am supposed to call upon these values?

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    Hmm try using Self.Text like you did originally, so try the below:

    If(
     Or(Dropdown1.Selected.Value = "1", Dropdown1.Selected.Value = "2"),
     ClearCollect(
     colRatedWelfare,
     {
     RatingTitle: Self.Text
     }
     )
    )
    

    See if it helps @JeckGill 

     

  • JeckGill Profile Picture
    242 on at

    If( Or(Dropdown1.Selected.Value = "1", Dropdown1.Selected.Value = "2"), ClearCollect( col_ratedWelfare, { RatingTitle: ThisItem.Title } ) )

    this is working - except for the "=", I'm getting a message that says
    "Incompatible types for comparison. These types can't be compared: OptionSetValue (Site Inspection Rating), Text.

  • JeckGill Profile Picture
    242 on at

    If( Or(Dropdown1.Selected.Value = "1", Dropdown1.Selected.Value = "2"), ClearCollect( col_ratedWelfare, { RatingTitle: ThisItem.Title } ) )

    this is working - except for the "=", I'm getting a message that says
    "Incompatible types for comparison. These types can't be compared: OptionSetValue (Site Inspection Rating), Text.

  • JeckGill Profile Picture
    242 on at

    Disregard last - I got that sorted. Brain fuzz from staring at it for too long haha.

    The expression is working, no blue or red lines - However the data isn't being collected 

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @JeckGill 

    That's because ThisItem.Title should be the correct one.
    The error you got is because the formula should be adjusted for using OptionSetValue.

    Try one of the two formulas below.

    If(
     Or(Dropdown1.Selected.Value.Value = 1, Dropdown1.Selected.Value.Value = 2),
     ClearCollect(
     col_ratedWelfare,
     {
     RatingTitle: ThisItem.Title
     }
     )
    )
    

    or

    If(
     Or(Dropdown1.Selected.Value.Text = "1", Dropdown1.Selected.Value.Text = "2"),
     ClearCollect(
     col_ratedWelfare,
     {
     RatingTitle: ThisItem.Title
     }
     )
    )
    

     

    Or just replace above where it says 

    Dropdown1.Selected.Value.<<INSERT HERE>>

    with the value appropriate for you.

     
    ThisItem.Title should be the one to use though, I believe, as I gave first, not Self.Text that you originally had.

     

    See if it helps @JeckGill 

  • JeckGill Profile Picture
    242 on at

    JeckGill_0-1693407273380.png

    JeckGill_1-1693407295370.pngJeckGill_2-1693407311942.png

    this is how things are looking at the moment - I'm using the ThisItem.Title, and using the value of the choice answer rather than it's actual text (they're the same though, which helps reduce confusion). It's still only parsing one item into the collection though. I can't tell why

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @JeckGill Well, for what you are trying to do here, I think you need more complex formula I believe that is why:

     

    If(
     Or(Dropdown1.Selected.Value = 1, Dropdown1.Selected.Value = 2),
     If(
     IsEmpty(Filter(col_ratedWelfare, RatingTitle = ThisItem.Title)),
     Collect(
     col_ratedWelfare,
     {
     RatingTitle: ThisItem.Title
     }
     )
     ),
     If(
     !IsEmpty(Filter(col_ratedWelfare, RatingTitle = ThisItem.Title)),
     ClearCollect(
     col_ratedWelfare,
     Filter(col_ratedWelfare, RatingTitle <> ThisItem.Title)
     )
     )
    )
    

     

    In the above, 

    • When the Dropdown's selected value is either 1 or 2, it should add the current item's title to col_ratedWelfare if it doesn't already exist in the collection.
    • If the selected value is not 1 or 2, it should remove the current item's title from col_ratedWelfare if it exists.

    Try the above, see if it helps @JeckGill 

  • JeckGill Profile Picture
    242 on at

    I think I just solved it as your email came in - it's ClearCollect that's the issue. I think as it goes through all the things in the list, it Clears them so it's left with just one at the end.
    You've definitley set me off in the right direction with those expressions though so thank you 🙂 I think what I'm going to do instead is just clear them when someone hits the back button to return to that page. That or try figure out how to do the clear collect on the next button page. 

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

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard