All,
I have spent a few hours going around in circles trying to solve something that should be super simple. I can’t tell if what I’m encountering is a bug or a quirk of a NoSql backend (?) or a latency issue?
Lets say I have two datatypes on my database:
- UniqueCount (with a single item as a number in it)
- Messages (with an array of messages)
I am passing a list to a backend workflow with two steps.
Step 1: Look Up & Increment UniqueCount:unique-number for getting unique sequential integers. In this case, I say Search for “UniqueCount”: and increment it by referencing unique-count= unique-count+1 (pseudo code)
Step 2: Then I say, add another message to the Messages from the list of messages, and in the numbers field, use the unique count
In this way, if I pass
message1, message2, message3 as a list to the workflow
I should get:
Number: 1 Message: message1
Number 2: Message: message2
Number 3, Message: message3
Number 4, Message: message4
…
But it doesn’t work - it doesn’t seem to increment UniqueCount sequentially in a loop. It seems to do it in parallel or something - so I end up with something like:
Number: 1 Message: message1
Number: 1: Message: message2
Number: 1: Message: message3
Number: 3 Message: message4
Number: 3. Message: message5
If I increase the size of the list, this kind of janky numbering continues.
This makes “no sense” unless it is not an iterative process or there is a delay between updating it and retrieving it, which I suspect? Does anyone know a workaround? Must I create a recursive function API call / for loop to solve this? Looking at logs gives no clarity.
N.b. I’ve burned through several thousand WU just trying to get my head around this. I can’t fathom why auto-incrementing an integer is so tricky (?).