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

Using multiple variables for status selection

Hello everyone, I'm currently building an App which tracks a recurring project in my organisation. There are about 15 different small phases in this project, which are stored in a combobox on a sharepoint list. My Power App uses the onselect of a checkmark button to trigger my variable "var" to be updated to true.

The If-formula inside of the defaultselecteditems of the combobox (On that screen) is:

If(var= false;ThisItem.Comboboxfield;LookUp(Choices([@SharePointList].Comboboxfield);Value="NextComboboxchoice"))

 

The NextComboboxChoice refers to the status that is assigned to the project if everything goes as planned (You could see it as a continuation of the "positive" path for the project). The variable var I created can be either true or false.

 

Now I'd like to implement a second variable into this formula, let's call it varFail, which sets the combobox choice to a "failed" choice (With different choices for "fails" later in the process). How could I do this? Is it possible within one If-formula?

2 REPLIES 2
BGR_
Frequent Visitor

Hi,

 

If I understand you correctly, you want your formula to evaluate both varFail and var. If so, you can use the functions And() or Or() to test both simultaneously. You can also nest If-formulas as shown below.

If(
    And(var = false, varFail = false),
    ThisItem.Combo...,
    If(
        var = false,
        ThisItem.Combo...,
            If(
            var = false,
            ThisItem.Combo...,
            IfFalse
        )
    )
)

 

Well kind of, I would like the default selected item to show a specific option in the combobox, if var is switched to true by the selection of a button. However if varFail is switched to true, I would like the defaultselecteditem to be another (negative) choice. Therefore I'm looking for an If-Statement that checks both variables and if one of them is true, the defaultselected item changes to one of the options that I want to be displayed

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,517)