Dynamically assign Order value?

I’ve re-created Vega.Andrew’s tutorial on creating a reorder-able drag-and-drop repeating group:

But I’m trying to figure out how to dynamically create a non-repeating Order number when a user clicks a button and creates a new DB entry.

I’ve tried everything I can think of but no luck.

Anyone have any ideas on how to do this?

I am also needing to do this. I have everything working right in my prototype but I need to figure out how to add a new order number when I add a new item to my repeating group. Help.