cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mars_1
Frequent Visitor

if statement multiple choice

Hi Fellas,

For the past days I’ve been smashing my head against the keyboard while chewing on glass and staring at the abyss of this “code” I’ve came up so far.

Since I can’t figure it out on my own I’m asking you for help.

My Database is a SharePoint Online List.

I’m currently using the 3.22051.27 Version of PowerApps

(european version) (..not sure if this is the correct way to label it. anyway)

Beside a few little differences between US and EU version like  “ , “ and “ ; “ there is not much difference in the syntax, If at all.

 

The SharePoint list has three columns.

Two of them are choice columns allowing multiple selections.

One Column is just a simple Textinputfield (Singleline Text)

I’m using this list as a database (source) for the EditForm in powerapps where the user can make the inputs.

 

Column1(MultipleChoiceColumn) (drpdwn_Hardware)

Hardware:          -Hardware1 

                          -Hardware2 

                          -Hardware1 Accessory 

                          -Hardware2 Accessory 

Column2(MultipoleChoiceColumn)

Accessory:          -Accessory1

                           -Accessory2 

                           -Accessory3 

 

Column3(SingleLineText)

                           -Textinput field

 

Now what I want to achieve is that based on the choices in Column1.

Column2 and Column3 either are visible or not.

 

If Hardware1 and or Hardware2 are picked,

Column3 is visible.

Column2 is not visible.

 

If Hardware1 and or Hardware2, Hardware1Accessory and or Hardware2Accessory are picked,

Column2 and Column3 are visible.

 

If Hardware1Accessory and or Hardware2Accessory are picked,

Column2 is visible.

Column3 is not visible.

-----------------------------------------------------------------

In the visibility Property of Column3  I’ve entered this code.

(something similar but adjusted for Column2 I wanted to enter in the visibility property of Column2.

Since the formular didn’t work for Column3 I let this one out.)

 

This is the "code": 

 

If(drpdwn_Hardware.Selected.Value="Hardware1"; true  Or If(drpdwn_Hardware.Selected.Value="Hardware1" And drpdwn_Hardware.Selected.Value="Hardware1Accessory"; true  Or

If(drpdwn_Hardware.Selected.Value="Hardware2"; true  Or

If(drpdwn_Hardware.Selected.Value="Hardware2" And drpdwn_Hardware.Selected.Value="Hardware2Accessory"; true; false ))))))

 

 

now the entered formular is correct and is not showing any errors by intellisense but is simply not doing what I think it should do. It refers to the first entry and leaves other input unchecked.

for example if I choose Hardware1 and Hardware1Accessory it turns Column3 invisible…

now at this point I’m stuck.

I tried to use the switch function but can’t wrap my head around it…

 

 

2 REPLIES 2
Ashwin7104
Super User
Super User

Hi @Mars_1 ,

 

Just for my understanding and make it simple, 

 

1) Column 2 should be visible when Hardware 1 or Hardware 2 is selected in column 1. 

2) Column 3 should be visible when Hardware1 Accessory or Hardware2 Accessory is selected in column 1. 

3) Both Column2 and 3 should be visible when Hardware 1/Hardware 2 and Hardware1 Accessory/ Hardware2 Accessory is selected in column 1.

 

For doing multiple selections, let's use combo box instead of dropdown.

 

In column 2 visible property -> "Hardware 1" in cmbColumn1.SelectedItems.Value Or "Hardware 2" in cmbColumn1.SelectedItems.Value 

 

In Column 3 visible property ->"Hardware1 Accessory" in cmbColumn1.SelectedItems.Value Or "Hardware2 Accessory" in cmbColumn1.SelectedItems.Value

 

Let me know if my understanding is incorrect, so we can tweak the logic accordingly.

Mars_1
Frequent Visitor

@Ashwin7104  thank you for your response and thank you for the hint with checkboxes. this made me search a bit more in depth. so i came across a video from Reza Dorrani (https://www.youtube.com/watch?v=xUep4uud1BE) which covers what i was looking for and in the blog of Matthew Devaney (Power Apps Multiple Selection Checkbox - Matthew Devaney) i could adjust a few other things. if someone is going to a similar struggle, this might help. 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,798)