web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If Statement with mult...
Power Apps
Unanswered

If Statement with multiple conditions

(0) ShareShare
ReportReport
Posted on by 166
I have got a combo box which contains values and is multi select enabled. The user can choose one or two items.
 
I want to show or hide buttons based on the user's selection. The user can choose any two items from the following list:
Project A
Project B
Project C
SAP A 
SAP B 
No Budget
Budget
Contact award
 
 
So for example, if someone chooses any item which includes "project" the project button will become visible and
if someone chooses any item which includes "SAP " the SAP button becomes visible. If they any of the SAP and Project items selected  both buttons will be visible
 
As there are 56 possible combinations using two items from the list above and since there is no difference between the form which will load if Projects A, B or C are selected (and the same for SAP A and B), is there a way I can do this easily without having to cover all 56 combinations? 
So far I've tried setting a variable if someone chooses "SAP A" and "Project A" and set it to true using the following statement as an example:
If("SAP" in Data cart selected Items true , Set(var, true)) 
However, the above statement still reruns the value "False" instead of "True".
Categories:
I have the same question (0)
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    a69.jpga70.jpg

    Set each button Visible property like this. All combination will be available

  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @ezi79 Place this code in the visible of the Project Button.

    IsMatch(Concat(ComboBoxIsMatch.SelectedItems.Value, Value), "Project", Contains & IgnoreCase )

     

    Similarly change the text "Project" to "SAP" etc., and place them in the corresponding buttons. This will take care of all the combinations.

     

    Hope this helps!

  • Verified answer
    v-albai-msft Profile Picture
    on at

    Hi @ezi79 ,

    You can use Find function to check the result. I did a test on my side for your reference.

    1. My combo box is called "ComboBox6":

    v-albai-msft_0-1623145805972.png

    2. Set Visible property of Project button to:

    If(!IsBlank(Find("Project",Concat(ComboBox6.SelectedItems, Value&","))),true,false)

    v-albai-msft_3-1623145922913.png

     

    3. Similar, set Visible property of SAP button to:

    If(!IsBlank(Find("SAP",Concat(ComboBox6.SelectedItems, Value&","))),true,false)

    v-albai-msft_2-1623145908699.png

    Here is the result:

    0608.gif

    Best regards,

    Allen

  • ezi79 Profile Picture
    166 on at

    Thank you so much its working saved me lots of time really appreciated 

  • ezi79 Profile Picture
    166 on at

    Thank you so much this solution also working for my scenario 

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @ezi79 Glad to help!

  • ezi79 Profile Picture
    166 on at

    I got another combobox within the same form and choices are different than the combo box above 
    combobox contains items such as and user should only select one item
    - PIC paper
    - Programme & project authority drawdown
    - Programme & project risk drawdown
    - Project initiation & business case
    - Budget change control
    - Unbudgeted transaction

    How do I combine this formula IsMatch(Concat(ComboBoxISMatch.SelectedItems.Value,Value), "Project", Contains & IgnoreCase  with the values above so if I choose one of the items above it will also make project button visible?

  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @ezi79 The key in the formula I gave you is the text within quotes. E.g. "Project" or "SAP". If you want to check for multiple texts, you can use this formula (add as many as you want),

    Or(IsMatch(Concat(ComboBoxIsMatch.SelectedItems.Value, Value), "Project", Contains & IgnoreCase ),
    IsMatch(Concat(ComboBoxIsMatch.SelectedItems.Value, Value), "Programme", Contains & IgnoreCase ),
    IsMatch(Concat(ComboBoxIsMatch.SelectedItems.Value, Value), "Budget", Contains & IgnoreCase )
    )

     

     

    Please remember to give a 👍 and accept the solution as it will help others in the future.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard