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 / Using the AND function...
Power Apps
Answered

Using the AND function in a drop-down control

(0) ShareShare
ReportReport
Posted on by 36

I am trying to hide a button and make it visible only when all the items in a drop-down are selected and submitted one after another.

I used the AND function and my code is shown below

In the Visible property of the Button, And (DataCardValue6.Selected. Value = "Board Secretariat / Legal Advisory", true, DataCardValue6.Selected. Value = "Corporate Communications Department", true, DataCardValue6.Selected. Value = "Finance and Accounts", true)

What I am trying to achieve is to make the button visible when a user has selected the values in the drop-down control and submitted all the values to a SharePoint list.

When I use an or operator instead of an AND operator, the button becomes visible once any value is selected in the drop-down control and this negates the condition of making the button visible only when all the values have been selected and submitted 

Any suggestions on what to do 

Kind regards

Categories:
  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    Hi @essienro ,

    I think you need this (note you do not need the true statements - if all three conditions are true, the button will become visible

    "Board Secretariat / Legal Advisory" in DataCardValue6.SelectedItems && 
    "Corporate Communications Department" in DataCardValue6.SelectedItems &&
    "Finance and Accounts" in DataCardValue6.SelectedItems

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • essienro Profile Picture
    36 on at

    Hi WarrenBelz

    Thanks for your response. I tried the solution you provided, and it still did not work. When I put only one item in the AND operator the button becomes visible, but when I add another item to the AND operator the button is invisible. An example of the codes is shown below

    And (DataCardValue6.Selected. Value = "Board Secretariat / Legal Advisory") button is visible

     

    And (DataCardValue6.Selected. Value = "Board Secretariat / Legal Advisory", DataCardValue6.Selected. Value = "Corporate Communications Department") button is invisible

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    Hi @essienro ,

    I am a bit confused as to what you want here - I thought you want the button to be visible only when all three values are selected - the code I posted does that.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • essienro Profile Picture
    36 on at

    Hi @WarrenBelz 

    Once again thanks for you responds, I am using a drop-down control which contains various department. Users need to answer a question by selecting a department, choose a choice and submit, but I need the users to answer the question for all the departments on the drop-down before moving to the next question, therefore the need for the next question button to be hidden till the user has answered the question for all the departments on the drop-down. I have attached various screens to give a picture of what I intend to achieve. Screen1 shows the initial screen with the question, the drop-down that contains the department and the choice control with the next question button hidden. Screen2 shows the drop-down with the various department and the next question button hidden. Screen3 shows a selected department from the drop-down and the next question button is visible. I used an if statement as shown here, If(DataCardValue6.Selected.Value ="Executive Director Business Development's Office", true). My worries is that a user can scroll to the last department (Executive Director Business Development's Office) bypassing the other departments and the button will be visible. Once again thanks

    Screen2.jpg
    Screen3.jpg
    Screen1.jpg
  • Verified answer
    WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    Hi @essienro ,

    Please look at your initial post as it describes something quite different (hence the responses to date). This is going to be a bit complex and on each submit button action on each question you need to add to a collection

    Collect(
     colResponses,
     {Department: YourDropDownName.Selected.Value}
    )

    Then the Visible on your Next button

    "Board Secretariat / Legal Advisory" in colResponses && 
    "Corporate Communications Department" in colResponses &&
    "Finance and Accounts" in colResponses

    Also add to your Next button code

    Clear(colResponses)

    and make your combo box Single Select.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

     

     

  • essienro Profile Picture
    36 on at

    Hi @WarrenBelz 

    Thanks for your assistance am grateful

    Kind regards, Richard

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard