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 / If statement with Patc...
Power Apps
Answered

If statement with Patch for empty TextInput fields

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone, 😃

 

I am quite new to  PowerApps, though I am keen to learn more about it. I have a question regarding the patch and the if statement since I got numerous errors after using both in the same OnSelect bottom field.

 

This is my logic (which is not working):

 

 

If(Namn.Text = "",//Here I would like to see if Text Input called "Namn" is empty and if so notify the user
Notify("Skanna ditt passerkortskort för att komma in", NotificationType.Error), //It is working although it allows the user to pass the screen to the next one and also collect the data to my SP database (which I do not want)
Patch('Troubleshooting app database'
{
'Avvikelse har loggats av/Deviation has been logged by':Namn.Text
'Antällningsnummer':Antallningnummer.Text, //Those statement are not working
}
)
Navigate(Identification,ScreenTransition.Cover) // here I would like as far as the if statement is not true to allow the user to go ahead to the next screen. 

 

 

 

It might be simple the answer, but my knowledge gap is loud here! 

 

I wonder if you guys have any suggestion on this matter?

 

Categories:
I have the same question (0)
  • Verified answer
    MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    Use the IsBlank function rather than say = ""

    Your patch is wrong because you have not told it what record to update, take a look at this: https://www.spguides.com/powerapps-patch-function/

    Are you using a Form? If so you can set the required property to true for error handling.

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
    Twitter: https://twitter.com/phipps0218




  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I'm using form though for the next screen.

     

    If(IsBlank(Namn.Text ,
     Notify("Skanna ditt passerkortskort för att komma in", NotificationType.Error), 
     Patch('Troubleshooting app database',Defaults('Troubleshooting app database'),
     {'Avvikelse har loggats av/Deviation has been logged by':Namn.Text,
     'Antällningsnummer':Antallningnummer.Text,
     )
     Navigate(Identification,ScreenTransition.Cover)
    )

     I have tried the default approach, though it did not succeeded . Feeling super dumb here 😞

  • Verified answer
    MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at
    If(IsBlank(Namn.Text),
     Notify("Skanna ditt passerkortskort för att komma in", NotificationType.Error), 
     Patch('Troubleshooting app database',Defaults('Troubleshooting app database'),
     {'Avvikelse har loggats av/Deviation has been logged by':Namn.Text,
     'Antällningsnummer':Antallningnummer.Text}
     )
     Navigate(Identification,ScreenTransition.Cover)
    )
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Skärmklipp.PNG

    Thank you so much for your prompt reply @phipps0218 , I appreciate it.

     

    Though I am facing the same error with your smart corrections 🙂

     

    AndressaLeonili_0-1658131733667.png

     

  • Verified answer
    MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    Remove .Text

    Before Navigate add ;

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    I think you should describe more details about your scenario.

    Here is what I get from your description:

    1). You want to send the notification and patch a new record at the same time

    2). Navigate to another screen if the condition is false

    3). Why Namn.Text reports an error since there must be a text string within?

     

    There is the thing, the Notify() could not work with the Patch() function at the same time.

    Please do provide a screenshot if words could not help you clarify better.

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 366 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 99 Super User 2026 Season 1

Last 30 days Overall leaderboard