Better understanding Counters

Good Day,

I would like to start using counters in my invoicing app to keep track of the Invoice Numbers, I am using codeless logic to design the app.

I have had a look at the following resources:

  1. Counter API - Backendless Codeless Development Guide
  2. Management of Backendless Counters and Cache - YouTube

Each company which will be using my app will create invoices to invoice their customers, there will also be multiple staff members (Users) linked to one company, each staff member can create invoices.

Now I would like to do the following:

  1. When a new company signs up to use my application, a counter specific to that company must also be created.
  2. The counter must start at 10000 for each new company.
  3. Every time an invoice is created the counter must increment by 1.

I need assistance with the following:

  1. How do I create a counter which will be linked to a Company?.. (I was thinking name the counter after the objectId of the company)
  2. How can I set the counter to start at 10000?
  3. What logic can I use whereby the counter will be set the first time the logic is triggered, but also will not be triggered again after the counter is created?

Kind Regards
Donovan

Hello @Donovan_Hardwick

  1. How do I create a counter which will be linked to a Company?.. (I was thinking name the counter after the objectId of the company)

Add company objectId to counter name

  1. How can I set the counter to start at 10000?

Create a counter and increase it to 10000 on company create

  1. What logic can I use whereby the counter will be set the first time the logic is triggered, but also will not be triggered again after the counter is created?

Don’t quite understand the question

Regards

Thank you @viktor.liablin

I would just like to check if I am doing it right…

Screenshot 2022-07-07 at 14.52.10

Kind Regards
Donovan

@Donovan_Hardwick

Looks good to me.
Use it only on create table event

Thank you @viktor.liablin