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 / Problem with IF functi...
Power Apps
Unanswered

Problem with IF function and IsBlank constraint

(0) ShareShare
ReportReport
Posted on by 413

Hello there. 

 

I'm using an app to write events in a list.

Basically, the pression of a button:

-creates an event with a name ("Evento");

-set a start date_time ("Inizio") for that row;

-set an end date_time ("Fine") for the previous event.

 

Take present that the app has a OnStart condition: 

 

Set(ID_Last;Last('STAMPA SETUP SEGNALAZIONI').ID)

 

 

Now I need to implement something that just puts an end to the actual event without creating a new row. And I had no problem with that. The problem is that if i push a button to create a new event, the end date_time of the previous row will be updated... no, thanks.

 

So i thought to escpare from this creating an if condition. If the "Fine" of the previous row is blank, than close and create. Otherwise, just create.

 

Here the code BEFORE:

 

//Set(ID_Last;Last('STAMPA SETUP SEGNALAZIONI').ID);;
Patch('STAMPA SETUP SEGNALAZIONI';LookUp('STAMPA SETUP SEGNALAZIONI';ID=ID_Last);{Fine: Now()});;
Patch('STAMPA SETUP SEGNALAZIONI';Defaults('STAMPA SETUP SEGNALAZIONI');{work_center_id: "10000102"; Linea: "3020";Evento: Self.Text;Inizio: Now()});;
Set(ID_Last;Last('STAMPA SETUP SEGNALAZIONI').ID);;
Notify("Segnalazione di " & Self.Text & " avvenuta con successo.")

 

 

and AFTER:

 

//Set(ID_Last;Last('STAMPA SETUP SEGNALAZIONI').ID);;
If(IsBlank(Last('STAMPA SETUP SEGNALAZIONI').Fine);Patch('STAMPA SETUP SEGNALAZIONI';LookUp('STAMPA SETUP SEGNALAZIONI';ID=ID_Last);{Fine: Now()}));;
Patch('STAMPA SETUP SEGNALAZIONI';Defaults('STAMPA SETUP SEGNALAZIONI');{work_center_id: "10000102"; Linea: "3020";Evento: Self.Text;Inizio: Now()});;
Set(ID_Last;Last('STAMPA SETUP SEGNALAZIONI').ID);;
Notify("Segnalazione di " & Self.Text & " avvenuta con successo.")

 

But every try is out of goal: it never close the previous row. 

Calcioscacchi_0-1664194017096.png

 

Am I missing something?

Categories:
  • Fredrik_A Profile Picture
    3,644 Super User 2026 Season 2 on at

    Try using IsEmpty instead, maybe thats the issue?

  • Calcioscacchi Profile Picture
    413 on at

    God operates in strange ways...

     

    I just put a Notify in case of False_value from IF function ,now it works.

    //Set(ID_Last;Last('STAMPA SETUP SEGNALAZIONI').ID);;
    If(IsBlank(Last('STAMPA SETUP SEGNALAZIONI').Fine);Patch('STAMPA SETUP SEGNALAZIONI';LookUp('STAMPA SETUP SEGNALAZIONI';ID=ID_Last);{Fine: Now()});Notify("FALSO"));;
    Patch('STAMPA SETUP SEGNALAZIONI';Defaults('STAMPA SETUP SEGNALAZIONI');{work_center_id: "10000102"; Linea: "3020";Evento: Self.Text;Inizio: Now()});;
    Set(ID_Last;Last('STAMPA SETUP SEGNALAZIONI').ID);;
    Notify("Segnalazione di " & Self.Text & " avvenuta con successo.")

     

    Calcioscacchi_0-1664194741160.png

    No way to understand this behaviour, but actually, in case of false value from the IF condition, I just want to exit from the if and go ahead with the rest of the code.... what should I write in the FALSE state of the IF?

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard