cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HansHeintz
Post Patron
Post Patron

Powerapps always evaluate every branch of an if statement?

Funny thing. I have a button to delete some data and I thought it would be efficient to change the button to a confirm button at first press and then do delete at second press. I use a variable.

In the onselect

 

If(
   lConfirmDeletePendingKuur
   ;If(
        !IsBlank(SelectedDierEventGallleryItem.KuurGUID)
        ;RemoveIf(
                    DierEvent
                    ;KuurGUID=SelectedDierEventGallleryItem.KuurGUID And EventtypeId=6
                    )
        ;;RemoveIf(
                    DitDierEvents
                    ;KuurGUID=SelectedDierEventGallleryItem.KuurGUID And EventtypeId=6
                    )            
        ) 
  ;UpdateContext({lConfirmDeletePendingKuur:true})
  ) <p>

 

Still after the first press (It just changes the variable) I see marching ants like it is changing my database. But nothing changes in the database so .. what is it doing?<br />I made another button that just changes the variable and tried it multiple times. The first button:marchin ants for 10 seconds. The second immedeately ready.</p><p> </p><p> </p>

1 REPLY 1
JR-BejeweledOne
Super User
Super User

Try changing your formula

 

If(
   lConfirmDeletePendingKuur
   ;
        
        RemoveIf(
                    DierEvent
                    ;!IsBlank(SelectedDierEventGallleryItem.KuurGUID) And                        KuurGUID=SelectedDierEventGallleryItem.KuurGUID And EventtypeId=6
                  
                    )
        ;;RemoveIf(
                    DitDierEvents
                    ;!IsBlank(SelectedDierEventGallleryItem.KuurGUID) And KuurGUID=SelectedDierEventGallleryItem.KuurGUID And EventtypeId=6
                    )            
       
  ;UpdateContext({lConfirmDeletePendingKuur:true})
  ) <p>


If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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