cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rhemo
Advocate III
Advocate III

Difficulty with Or Operator

Iam trying to test if a dropdown list has had 1 of 4 options selected. List contains "Sports, "In-Service", "BOM", "Other".

 

My formula in a label is 
If(ActivityTypeDrpBox.Selected.Value="Sports" || "In-Service" || "Other",Distance.Text*First(CurrentRates).Rate)

However it only proves true if Sports is selected, and false for anything else.

I also tried

Or(If(ActivityTypeDrpBox.Selected.Value="Sports" , "In-Service" , "Other"...etc but that throws an error of invalid argument type (Text)

Testing the syntax in a separate text label with ActivityTypeDrpBox.Selected.Value="Sports" || "In-Service" || "Other" again only proves true for "Sports".

Can someone help me with the syntax please or can we not use Or to check for dropdown values?

1 ACCEPTED SOLUTION

Accepted Solutions
chrisog
Responsive Resident
Responsive Resident

Hi @Rhemo,

 

The issue you have here is that you need to add the full equality statement for each value you are checking for. For example, your formula If(ActivityTypeDrpBox.Selected.Value="Sports" || "In-Service" || "Other",Distance.Text*First(CurrentRates).Rate) should be

If(ActivityTypeDrpBox.Selected.Value="Sports" || ActivityTypeDrpBox.Selected.Value="In-Service" || ActivityTypeDrpBox.Selected.Value="Other",Distance.Text*First(CurrentRates).Rate)

View solution in original post

3 REPLIES 3
chrisog
Responsive Resident
Responsive Resident

Hi @Rhemo,

 

The issue you have here is that you need to add the full equality statement for each value you are checking for. For example, your formula If(ActivityTypeDrpBox.Selected.Value="Sports" || "In-Service" || "Other",Distance.Text*First(CurrentRates).Rate) should be

If(ActivityTypeDrpBox.Selected.Value="Sports" || ActivityTypeDrpBox.Selected.Value="In-Service" || ActivityTypeDrpBox.Selected.Value="Other",Distance.Text*First(CurrentRates).Rate)

View solution in original post

v-xida-msft
Community Support
Community Support

Hi @Rhemo ,

Could you please share a bit more about your scenario?

Do you want to calculate the Distance.Text*First(CurrentRates).Rate formula when Dropdown selected value is "Sports", "In-Service" or "Other"?

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the Text property of the Label to following:

If(
   ActivityTypeDrpBox.Selected.Value = "Sports" || ActivityTypeDrpBox.Selected.Value = "In-Service" || ActivityTypeDrpBox.Selected.Value = "Other",
   Distance.Text * First(CurrentRates).Rate
)

Note: The ActivityTypeDrpBox.Selected.Value="Sports" || "In-Service" || "Other" syntax is not supported in PowerApps currently.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @chrisog

thank you very much that was it! Much appreciated 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,335)