If(
IsBlank(Form1.LastSubmit); // Check if the form is new (blank record)
EasyTravelFlow.Run( // If new, create a new record
Nome.Text;
Dipartimento.Text;
Tipologia.Text;
Text(Data1.SelectedDate; "yyyy-mm-dd");
Ora1.Selected.Value;
Minuto1.Selected.Value;
AeroportoPartenza1.Selected.Value;
VoloPartenza1.Text;
Text(Data2.SelectedDate; "yyyy-mm-dd");
Ora2.Selected.Value;
Minuto2.Selected.Value;
AeroportoRientro1.Selected.Value;
VoloRientro1.Text;
Value(Costo.Text);
Value(Int.Text);
Round.Selected.Value
);
Patch( // If the form has been submitted before, update the existing record
'Volo Database'; // Data source (SharePoint list)
Form1.LastSubmit; // The existing record to update (from Form1)
{
'Nome (John)': Nome.Text;
Dipartimento: Dipartimento.Text;
Tipologia: Tipologia.Text;
'Data Partenza': Data1.SelectedDate; // Pass DateTime directly
'Aeroporto Partenza': { Value: AeroportoPartenza1.Selected.Value };
'Volo Partenza': VoloPartenza1.Text;
'Data Rientro': Data2.SelectedDate;
'Aeroporto Rientro': { Value: AeroportoRientro1.Selected.Value };
'Volo Rientro': VoloRientro1.Text;
Costo: Value(Costo.Text);
Int: Value(Int.Text);
Round: { Value: Round.Selected.Value }
}
)
);
Set(varShowPopup; false) // Close the popup after the action (No semicolon after this statement)
--------------------------------------------------------------------------------------------------------------------------
Specifically I am getting the error on the ; here:
);
Set(varShowPopup; false)
It says the characters are unexpected. I am using characters in an unexpected way. Even though because of my region, the syntax (;) is correct.
Second set of formulas:
// Initialize the screen
Set(isEditing; false); // Default to new record mode
UpdateContext({ varShowPopup; false }) // Hide popup on screen load
Same issue with syntax (;) after the formula: Set(isEditing; false);
This is because I have an add/update button that should let the user add a new row to sharepoint (database), but also update the same row if need be. I don't want sharepoint to add a new row every time the user clicks add/update. The user may click add/update, and a new record is created in sharepoint, but if they realize there is a mistake they should be able to edit the same record within powerapps and consequently the same record in sharepoint gets updated, not that an entirely new row gets created. Ps. I copied and pasted these formulas from Chat GPT and my other ones work.
I only have these two errors for now, but I would like to add other functions to my app, so I'll probably be back here. Thanks!