Unique Ideas
Search…
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

{
"counter_name": "test_counter",
"counter_value_list": [
"1001"
],
"response_code": 200,
"response_message": "Successfully initialized test_counter to 1001 for your_user_name",
"user_name": "your_user_name"
}

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
Using an Action
Using the Get data from external API
Using the Get data from external API

JSON response

The response will include a list of the IDs requested
{
"counter_name": "testing_counter",
"counter_value_list": [
154
],
"response_code": 200,
"response_message": "Successfully returned incremented counter",
"user_name": "your_user_name"
}

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

{
"counter_name": "testing_counter",
"counter_value_list": [
155
],
"response_code": 200,
"response_message": "Successfully returned testing_counter for your_user_name",
"user_name": "your_user_name"
}
Copy link
On this page
Use Case
Sample Implementation
Creating UniqueCounter's
Retrieving a UniqueCounter
Viewing a UniqueCounter