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 / I need an Update if Else?
Power Apps
Unanswered

I need an Update if Else?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All

 

I am very new to PowerApps but I am also finding it great to work with most of the time.

 

I have nearly created a guest sign in book, but I have hit a snag when trying to either update an existing record or create a new one.

I have both arguments in my code but hte are separates by a semi colon and so the app runs both commands, therefore editing one record and creating another.

My code reads

UpdateIf(Table1_14, Name =DataCardValue1.Text && Time_x0020_Out<>Blank() && Time_x0020_In="",{Time_x0020_In:Clock_5.Text, Location: "On Site"});

If(!IsBlank(Form2),

SubmitForm(Form2)&&

Navigate(ThankYouIn, ScreenTransition.Fade))

 

So it first updates the table if the paramiters are met, but if they are not met I want it to submit form. After each I would want it to navigate to the thank you screen. Both pieces of code work in isolation and both work together but I cannot get them to work Update else work Submit form

 

Any help is much appreciated however daft I have been.

 

Rinceward

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Looks lke you need to simply embed your if statements.  Somthing like...?

     

    If(
     //is this true?
     !IsBlank(Form2),
     //if so do these things
     SubmitForm(Form2);
     Navigate(ThankYouIn, ScreenTransition.Fade),
     //else do these things
     UpdateIf(Table1_14, Name =DataCardValue1.Text && Time_x0020_Out<>Blank() && Time_x0020_In="",{Time_x0020_In:Clock_5.Text, Location: "On Site"});
     Navigate(ThankYouIn, ScreenTransition.Fade)
     )

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Philashby

     

    Thankyou for answering my question so quickly.

     

    However this solution does not quite work how I wanted.

     

    I have amended the code slightly to check if record is in table firsdt and that updates fine. However if it does not find that record it doesn't create a new record by subitting the table.

     

    If( !IsBlank(Form2), UpdateIf(Table1_14, Name =DataCardValue1.Text && Time_x0020_Out<>Blank() && Time_x0020_In="",{Time_x0020_In:Clock_5.Text, Location: "On Site"}); Navigate(ThankYouIn, ScreenTransition.Fade), SubmitForm(Form2); Navigate(ThankYouIn, ScreenTransition.Fade))

     

    So frustrating as it seems so simple Smiley Frustrated

     

    Rinceward

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Would an or operator work in this situation? Either check if record needs updating OR submit form?

     

    Gareth

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Just out of interest, try removing your screen transistion after your form submission.  Maybe the transistion is overriding the submission?  Add in a notify statemrnt to confirm that it's acting that part of the If statement eg Notify( "Should have submitted the form here" )

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have done this and I have gotten the notify to pop up. Again though once the statements are in, It completes both updates the record and then inserts a new record. Both options navigate to correct screen however.

     

    If(!IsBlank(Form2),UpdateIf(Table1_14, Name =DataCardValue1.Text && Time_x0020_Out<>Blank() && Time_x0020_In="",{Time_x0020_In:Clock_5.Text, Location: "On Site"});
    SubmitForm(Form2);
    Navigate(ThankYouIn, ScreenTransition.Fade))

     

    Rince

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Rince,

     

    looking at your statement, you don't seem to have an ELSE condition.  It should be seperated by commas.  eg...

     

    IF (MYCONDITION, DO THIS, ELSE DO THIS)

     

    You can add multiple stages to each area by seperating the commands with semi colons.  

    Your code is currently saying...

     

    IF (!IsBlank(Form2)...then do these things:

     

    First.... UpdateIf(Table1_14, Name =DataCardValue1.Text && Time_x0020_Out<>Blank() && Time_x0020_In="",{Time_x0020_In:Clock_5.Text, Location: "On Site"});

    Then...SubmitForm(Form2);

    Then...Navigate(ThankYouIn, ScreenTransition.Fade)

     

    But it's not doing any ELSE condition.

     

    I think your semicolon (in red) after the Updateif should be a comma?

     

    That way it will read

     

    IF (!IsBlank(Form2)

     

    Do this...UpdateIf(Table1_14, Name =DataCardValue1.Text && Time_x0020_Out<>Blank() && Time_x0020_In="",{Time_x0020_In:Clock_5.Text, Location: "On Site"}),

     

    ELSE do this....

     

    SubmitForm(Form2);

    Then...Navigate(ThankYouIn, ScreenTransition.Fade)

     

    So, try this code..unless I'm misunderstanding the question! - I've added in another transistion after the update.

     

     

    If(!IsBlank(Form2),UpdateIf(Table1_14, Name =DataCardValue1.Text && Time_x0020_Out<>Blank() && Time_x0020_In="",{Time_x0020_In:Clock_5.Text, Location: "On Site"});Navigate(ThankYouIn, ScreenTransition.Fade),
    SubmitForm(Form2);
    Navigate(ThankYouIn, ScreenTransition.Fade))

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Philashby

     

    Thank you for spending so much time helping.

    Using your exact code as you said the record will update but it will not create a new record. 

    Again it navigates to the correct screen each time

     

    Rince

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I could also add the creen transition as a separate operation, to take it out of the if else statement.

    Would that help?

     

    Rince

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hmmm...it shouldn't matter.

     

    I reckon you should go back to basics and test each element - for example, if your button just did a submitForm, does that work?  If it did just the Update, does that work?  Get it to notify the value of each key element, so ensure it's value is what you think it is.  Sometimes, it's something as simple as assuming that a value is X, when in fact it's Y.  Looking at the code, I can't see why it should fail, but without seeing the actual app, it's difficult to tell 😞

     

    Good luck!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I've just been playing with forms and for me, IsBlank(myFormName) gives me a false output regardless of whether I'm editing the form or creating a new record - so, a blank form gives me the same reading as a full one.  Seeming to indicate that it's not performing as you think?  Create a text field to output the value, or pass it to a Notify to validate it...?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard