cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Muhammad_Ali
Level: Powered On

How to use else if condition?

Hi,

 

I want to use else if condition over Display Mode property of field, e.g. If <Condition>, <DisplayMode.Disabled> else if <Condition>, <DisplayMode.Disabled> else <DisplayMode.Edit>.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: How to use else if condition?

Hi Muhammad_Ali,


There are a couple of ways to do this using either If() or Switch() functions.

The If() function was also updated to operate much like a Switch statement, so you can probably just use If()

 

If( Condition, ThenResult [, DefaultResult ] )
If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

 

or looking at it another way;

 

If(condition, trueresult, condition, trueresult, condition, trueresult, defaultresult)

 

For your example;

If(condition, DisplayMode.Disabled, condition, DisplayMode.Disabled, condition, DisplayMode.Edit)

Hope this helps,


RT

 

View solution in original post

3 REPLIES 3
Super User
Super User

Re: How to use else if condition?

Hi Muhammad_Ali,


There are a couple of ways to do this using either If() or Switch() functions.

The If() function was also updated to operate much like a Switch statement, so you can probably just use If()

 

If( Condition, ThenResult [, DefaultResult ] )
If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

 

or looking at it another way;

 

If(condition, trueresult, condition, trueresult, condition, trueresult, defaultresult)

 

For your example;

If(condition, DisplayMode.Disabled, condition, DisplayMode.Disabled, condition, DisplayMode.Edit)

Hope this helps,


RT

 

View solution in original post

Community Support Team
Community Support Team

Re: How to use else if condition?

Hi @Muhammad_Ali,

 

The else if condition is not supported within PowerApps currently. I think the If function could achieve your needs within PowerApps.

 

The standard formula format of If function as below:

If( Condition, ThenResult [, DefaultResult ] )
If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

On your side, please take a try to set the DisplayMode property of the field to following formula:

If(
Condition1,
DisplayMode.Disabled,
Condition2,
DisplayMode.Disabled,
DisplayMode.Edit
)

More details about the If function in PowerApps, please check the following article:

If function

 

 

Best regards,

Kris

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.
Muhammad_Ali
Level: Powered On

Re: How to use else if condition?

Thanks, it is working.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,778)