Auto increment ID not working

Hi there,

I have a table where I am registering some orders added by users through the UI.
I am sort of faking an ID for each order by trying to use the following formula to always generate the latest ID + 1:

{{ ? 0 : parseInt(Math.max(}}

However, at each run, all I get is the id = 0, I however do see there are new rows in the .id attribute being generated:

I have also just recently tried a different approach:

{{ ? 0 :[5]+1}}
The above calculation works when I use the 5th position of the id array, but when I try and replicate the same value with the following calculation, I get "undefined":

{{ ? 0 :[]+1}}

When I evaluat this individually:

The result is a number with the value 5, so theoretically this should work no?
Perhaps I am missing something?

Just to make sure, quotes here is the query not the table right?

I'm assuming the query returns an array of records, try: