How to increment value for each new data type record in a data type?

I already know that there is a unique ID field created for every data type record, but I want to add a numerical ID field to use as a unique ID for each data type record that’s easier to read.

How can I do this as I add records to a data type?

Here’s an example.

So in this example the next record that is submitted should be 8.

When using a repeating group, you can simply get the current cell’s index:

1 Like

As George says, you can put the index number easily in a list, using “index”. That is built every time the list is created.

If you wanted to preserve the number as you add new ones (so stores on database) you could retrieve the highest number and add 1 (sort on number and use :first).

I’m worried about deletions over time and the numbers no longer being unique. I think I’m going to create another data type and use one row in it to increment for each data type that I want to create a unique id field in.

Thanks for the ideas though.

The count number in the Display Group is generated each time the list is iterated through, and automatically updated each time the list is updated. So per Repeating group, they are guaranteed to be unique.

Why do you need them to be unique?

@georgeciobanu I’m not necessarily using a repeating group and I wanted an easier to read format than Bubble’s Unique ID field to use in future workflow. I created an Order Master data type to increment an ID every time I create a new record in any of my other data types.

Screenshot of Order Master data type

Screenshot of Term data type with incremented ID from Order Master being used to create the term’s term_id field’s unique value.

1 Like