Need help with Multiple UPDATE and INSERT Server Action Steps

I have two DB tables which when queried result in this

image

Which displays like this on a page

The data for the two lines “(3) Lease Condition” and “(5) Diminution in Value” come from this “Fees” table

If the user then makes a change to “(3) Lease Condition” and adds data to “(8) Post-Repair” like this

I then want a Server Action to process the form, UPDATE the “Fees” table when there is a change and INSERT into the “Fees” table when there is new data, and do nothing with the lines where nothing is entered.

I am really struggling to get my head around how to plan out the Server Action Steps.

I know it’s a case of submitting the form
then the Server Action will have
DB Connection
Condition
Then
UPDATE
Else
INSERT

BUT I can’t work out the detail with the repeats etc.
Can someone help? An example would be brilliant.

Community Page
Last updated: