Using UniqueCounter's
UniqueCounter's are auto-incrementing numeric fields that maintain uniqueness even under load.
Use Case
You as the developer, create a UniqueCounter field including the numeric starting point for this field. When adding things into your Bubble database, you set the id field you'd like to track to your UniqueCounter which when called will provide the next value in the sequence.
Sample Implementation
Installation of the plugin must be completed first -- Instructions found HERE
Creating UniqueCounter's
You may create as many UniqueCounter's as you need, however the creation of any counter is only done once, to establish the field. UniqueCounter's are always numeric only.
Add the Create UniqueCounter action to a workflow.
Set the name of the UniqueCounter you'd like to use ("order_id", "invoice_id", etc.)
Set the starting point of the counter (1001, 10000, 934532, etc.)
When the workflow is executed, a new UniqueCounter will be created. The status of this is provided by the action. A response code of 200 indicates it was successfully created. A response code of 400 indicates and error and further information is provided in the response message. The actual JSON provided is shown below, and it can be evaluated using the typical Result of Step x syntax.
JSON response
Retrieving a UniqueCounter
Retrieving the the value of a UniqueCounter is done either by the "Get UniqueCounter" action or using the "Get data from external API"
You may retrieve one or many ID's in a single call by setting the number_of_ids
JSON response
The response will include a list of the IDs requested
Viewing a UniqueCounter
Viewing a UniqueCounter allows you to view the next value of the counter, without incrementing its value. Use the "View UniqueCounter" setting the name of the counter you'd like to view.
JSON response
Last updated