Why do you need a Query for this though? I think it’s too simple to use a Query. If you want to number things after a query then you can use my arrayformula.
Let’s say the destination column is called ‘Order ID’.
Create a Rollup column that takes the Max of Order ID - call that MaxOrderID.
Then create a Math column that is MaxOrderID + 1 - call that NextOrderID.
And NextOrderID is then used in the form submission.
PS. I use this method in that thing I shared with you the other night
I agree with @Darren_Murphy’s method. It’s a lot safer than having a formula create the number…especially using the order number example. Otherwise with an arrayformula and dynamic numbering, it’s too easy to delete one row and have all order numbers get renumbered and messed up. I think the best way is to have one column with just a number and another column with the alpha characters, then build the complete order number with a template column.
I think to get the left padded zeros, you could take the number, divide by 1000, create a template to lock in the value and replace the decimal with nothing.
So smart. I guess I wasn’t reading the post closely enough…I missed the part about form submission…I was assuming just ordering rows. Jeff’s solution with the template column is clutch.
this is so smart! but if want to duplicate something between 0001, and 0002. example 0001 i need duplicate to become 0002, and previous 0002 become 0003 and continuous the following number. if i did duplicate in Glide app, my google sheet arrayformula/query will become error.
I think I was thinking about using a template column and replacing the decimal point there, but trying out, I realize now that you need to have another column with a blank value for the replacement and the template doesn’t seem to like numeric columns as the base template, so it would first have to be converted using another template column to alpha. Seems to work, but ultimately not any more efficient than your solution.
If there are a lot of simultaneous submissions, are you sure 2 or more rows will not take the same Roll UP +1 and consequently 2 rows will have the same number??