cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Calcioscacchi
Helper III
Helper III

Close a event lookuping at his name

Hi there.

 

Recently I built an app where I close a event by starting a new one. TO do that, I lookup to Last_ID row created, close it (givindg a value to "Fine" event) and opening a new row, updating Last_ID. For istance, when i press a button with the name of the event:

 

 

 

 

 

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

 

 

 

 

 

New challenge is on the way. I should do more events at the same time, so I thought to a Stort and stop system: for any event, a button to say "start" and a button to say "Stop".

Now the problem is: if I start 2 different events, with my previous logic i'll close always the last row. So I need something like:

"find the last row with THAT event name, and close it".

 

The problem is how to find the last row with that event name, without updating an old one. 

Suggestions? I'm freaked by use the IDs this time...

 

 

IDLineawork_center_idEventoInizioFine
43302010000102PRIMA STAMPA26/09/2022 15:0926/09/2022 18:01 (NOT TO BE UPDATED)
44302010000102FINE ORDINE26/09/2022 18:01 
45302010000102PRIMA STAMPA26/09/2022 18:01TO CLOSE!
46302010000102CAMBIO MANICHE E ANILOX26/09/2022 18:37 
1 ACCEPTED SOLUTION

Accepted Solutions
Calcioscacchi
Helper III
Helper III

SOLVED!

 

For my istances, I just set a variable for each Start event. When I push the Stop button, I'll lookup for the row with that ID and set the End evet date.

Set(ID_LastFO;Last('STAMPA SETUP SEGNALAZIONI').ID);;
Patch('STAMPA SETUP SEGNALAZIONI';LookUp('STAMPA SETUP SEGNALAZIONI';ID=ID_LastFO);{Fine: Now()});;

 

 

View solution in original post

1 REPLY 1
Calcioscacchi
Helper III
Helper III

SOLVED!

 

For my istances, I just set a variable for each Start event. When I push the Stop button, I'll lookup for the row with that ID and set the End evet date.

Set(ID_LastFO;Last('STAMPA SETUP SEGNALAZIONI').ID);;
Patch('STAMPA SETUP SEGNALAZIONI';LookUp('STAMPA SETUP SEGNALAZIONI';ID=ID_LastFO);{Fine: Now()});;

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,407)