web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple statements in...
Power Apps
Answered

Multiple statements in IF-TRUE branch

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

in another message I read that

you can chain multiple functions in a true case of an if by using ";" as delimiter.

 

but on my locale, ";" is the default delimiter. which delimiter could I use then to get multiple statements executed for an if-true branch?

Categories:
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    You'd use the ';;' character pair to separate multiple statements, something along the lines of the expression below:

    If(
     TextInput1.Text = "";
     Set(isEmpty, true);; Set(isError, true);; Set(another: 123);
     Set(isEmpty, false);; SubmitForm(EditForm1))
  • sscarcella Profile Picture
    239 on at

    is this for real?  I cannot get ;; to work at all.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    yes. maybe you have a different locale? then "," is your thing.

  • MrsNaniPenny Profile Picture
    31 on at

    Hi

     

    I have tried both ,, and ;; and they do not work. Upon further investigation I found that && does the trick.

     

    You are, however, not allowed to do certain actions together, for example, you cannot do anything with collections, like a ClearCollect AND something else.   If you do, you'll get an error, which basically indicates what only certain actions can be chained together. Setting variables, refresing data sources, etc. seem to work fine with the && operator. I have not tried all other action combinations, so do not have a definitive list, so you'll have to try and see what works.

     

    See this example that I use in one of my apps. It updates an image data source, puts the images in a collection and then sets the image variable.

     

    If(currentImageID = LastImageID, Refresh(Images)); //do this if true
    If(currentImageID = LastImageID,ClearCollect(colImages, Images));  //do this if true
    If(currentImageID = LastImageID,
        Set(currentImageID, First(colImages).ID) //do this if true
           && Set(LastImageID, Last(colImages).ID), //and this if true
        Set(currentImageID,currentImageID+1)) //else if false

     

    If I had not had the need to put the images in a collection, the statement would have looked like this:

    If(currentImageID = LastImageID,

        Refresh(Images//do this if true
           && Set(currentImageID, First(colImages).ID) //and do this if true
           && Set(LastImageID, Last(colImages).ID), //and do this if true
        Set(currentImageID,currentImageID+1)) //else do this if false

     

  • ArjenHofland Profile Picture
    8 on at

    If you use , between arguments in your formula, then ; is used to separate different statements. If ; is used between arguments, then ;; is used to separate statements. It has to do with local settings. , & ; = American. I have Dutch setting an need to use ; & ;; .

    I hope that clarifies this issue.

     

    P.S. 

     

    Good to remember this when you find code snippets on the net. Can be the difference between working code and "angry" code

  • NehaChauhan Profile Picture
    12 on at

    Worked perfectly for me! Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard