Problem with incrementing field in API workflow

I am trying to generate an incrementing invoice number for a series of billings in an API workflow. The Next invoice number is stored in a field in a table/data type called Control. I use “Make changes to thing” to update this value to this value +1. When the workflow runs the nextinvoicenumber field is incremented erratically (see Inv# for 1st 6 items on attached list). I suspect this is due to timing issues in updating the Control record in the workflow. Is this a bug?

A couple of things you could try:

  1. If there’s only ever one record in Control (it seems that way because you’re updating one record rather than adding a new one every time) then NextInvoiceNumber should just be This Control’s NextInvoiceNumber + 1. You shouldn’t need to do a search again.

  2. In your Create a new Billing step, try setting InvoiceNumber to Result of step 1’s NextInvoiceNumber. This should force step 2 to wait for step 1 to finish - if it isn’t doing so already.

Hope it helps.

Thanks for your suggestion.

That was where I started. I have tried many variations since then. This the result taking your advice:

still erratic numbers in Inv#.

It may not make a difference but your second screenshot still shows you setting NextInvoiceNumber with a search. Try setting it to “This Control’s NextInvoiceNumber + 1”.

Tried that too, same result.

I have recently had some update issues with APi workflows, in much the same situation - updating a single row many times.

When spaced up (2s interval) it updated fine. When running at 0 interval, bubble failed to make >50% of the updates even though I go no errors.

This is fairly recent, as I have done this in the past OK I think.

Spacing by 2 or by 3 did not help. Repeating the Control change 3 times (to give the DB time to update) did not help. Implementing a simple incrementing number has used up a week of time with no success so far.
Consider providing a function in Bubble (suggest calling it INCREMENT) which performs this frequently required function.