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.

Am I missing something?