Form. How to discriminate between insert vs update mode

Hello.
I need some suggestion on how to understand in a form application if I am inserting a new record or updating a new one.
One option could be to add in the load event something like:

If ( empty({primaryKeyField}) ) … // INSERT MODE

else

// Update mode

you can see there another try
https://www.mysqltutorial.org/mysql-insert-or-update-on-duplicate-key-update/

If the table has autincrement… SC set automatically the next sequence.
there are macros for know the mode: [TABLE=“cellpadding: 5, cellspacing: 0”]
[TR]
[TD=“width: 20%”]sc_btn_insert returns “true” if press the add button.[/TD]
[TD=“width: 27%”] [/TD]
[/TR]
[TR]
[TD=“width: 20%”]sc_btn_new returns true" if press the new button [/TD]
[TD=“width: 27%”] [/TD]
[/TR]
[TR]
[TD=“width: 20%”]sc_btn_update returns true" if press the update button[/TD]
[/TR]
[TR]
[TD=“width: 20%”] [/TD]
[/TR]
[/TABLE]

If the autoincrement is managed by the DB engine, i.e. “Auto increment (automatic)” in SC, checking for an empty primary key works perfectly.
I do it all the time.