@Dave-ITMan
Your problem with this approach is that your app is going to grind to its knees! In order to get the current next ID, you are going to need to refresh your QualityPortal data source. Doing a Refresh on the data source every second will cause the app to deadlock. A refresh typically takes more than a second to complete.
My suggestion is that you let the ID be the ID! It is unique all the time when you create a new record. So, there is no need to assign one yourself (and, you can't assign an ID as the primary key).
If you are using the ID to generate some other formatted ID (ex: MMDDYYY-ID) then I would recommend either of the below solutions:
1) Let PowerAutomate do the work. It can trigger when a record is created and generate your formatted ID.
2) Use a calculated column. You will not be able to get the value of it prior to submitting, but once submitted, the submit will return the calculated value.
3) Refresh the datasource prior to submitting. This will consume time in your app, and is still not guaranteed to produce accurate results (as someone else can submit from the point of refresh to the point of submit)
Any of the above are viable options.
I hope this is helpful for you.