Is there a way to make more than one thing from scratch?
I’ve got a thing Card.
I want to create 100 “cards”, each with a unique random number. I can’t figure out a way to create more than one thing at a time. There’s a way to create more than one thing as long as you already have a list, but I don’t have a list. I have a range, like card number 1 to 100.
Create a data type that is just a number, and populate it with numbers 1 > 100.
Then schedule an API workflow on the list of numbers, this way you can even limit the list (provided you know the number of things you want to create in advance) by sorting on the number and limiting the search to <= the number of things you want.
I made a thing Card_Template that just has one field Number. Then I manually created 10 Card_Template rows where the Number field has 0-9 in it.
What I’m trying to do is send that list of Card_Templates to an API Workflow which will create a new Card and then increment this Card_Template’s Number by 1.
Then I’m trying to return the Card that was just created via the Return Data From API action. I figured I could add each Card to a list in a custom state and then display them in a repeating group.
But the Schedule API Workflow action doesn’t say anything about getting data back and the next action doesn’t seem to be able to access any data that might have been returned.
We can schedule a workflow to happen more than once. All we need is a list that has the same number of entries as desired repetitions. Want 10 cycles, then get a list with 10 entries.
But the actual items in the list don’t matter. We can ignore them in each repetition of the workflow.
So this is just a “repeat from 1 to 10” structure except constructed in the most tedious way possible. The loop happens, but first you have to teach a computer how to count.
Also, the workflows are delayed. If you need a lot of new things you have to wait for each individual workflow to kickoff one or two seconds apart.
Does this look like an okay way to handle the possibility of duplicate codes?
Since the API Workflow actions can’t handle custom states I made a new thing called Code_Cache and made a single entry, then passed it into the API Workflow. I’ve got three steps that can generate the code. Step 1 creates a code and puts it into Code_Cache’s Code. Then step 2 will replace that code with a new one When a search for any Card that already has Code_Cache’s code returns a Count >0. Step 3 is the same as step 2.
Seems like the odds of generating identical 20 character codes are already pretty low, and that’s three two chances to try again.