eddie
April 12, 2016, 10:05pm
1
I had around 4,700 existing rows of a data type that I wanted to add a new yes/no field to. @NigelG was kind enough to walk me through it. Might prove helpful to another Bubble user so @NigelG suggested I recap it here…
NigelG:
You will need to turn on the API workflows in Settings/API for Post.
Then at the bottom of the list of Pages you will see “API Workflows”
In here you create the workflow you want to run. But for a SINGLE thing. Don’t try to do a bulk update at this time (will explain). You will also need to add a parameter for the type of thing you want to update.
So here I am updating a single listing.
Then go into your data tab, and create a view of the things you want to update.
And choose Bulk Action, and chose the workflow you just created.
Run it an away you go.
The bit that isn’t clear is that the API workflow is a single operation, the “Bulk” bit is in the Data tab.
If your workflow does a “Change list of things” then it will run for every input. So I was updating 5000 rows, and each row I was updating ran a workflow that updated 5000 rows … no wonder it was slow !
I still wasn’t completely getting it at this point.
Thanks for the Bulk Edit walk through. I have about 4700 rows of a data type (Voucher) that I’ve added a new field to (Active). The Active field type = yes/no. I want to set all 4700 rows to Active = yes. I assume a bulk action is the best way to go here because the new Active field is empty for all 4700 existing Vouchers. I tried setting the default Value to “yes” after creating the new Active field, but that Active field still remained empty for all Vouchers. Getting stuck building out the API workflow.
Not sure what to do with the “key” when adding the parameter.
Also getting stuck when building out the action. Bubble seems to be changing my “Make change to a voucher” choice to “Make change to a list of vouchers” and I can’t figure out why. And not sure how to complete the “Thing to change” formula… “Search for Vouchers Active” is where I’m hitting a wall cause I expect there to be an “empty” option, but there isn’t one. Yes or No hasn’t been set yet so the field should be empty, but I’m not seeing an “empty” option when building out the formula and none of the other options seem like the right path.
I’ve built it out in the forum app that we had previously worked on… Forum_app | Bubble Editor
@NigelG ’s following reply cleared it up for me…
NigelG:
So the trick is to think about update a single voucher in the Workflow API.
We want to pass a voucher “thing” in and update it.
So the parameter is voucher (although the name doesn’t matter) of type Voucher.
The thing to change becomes the “voucher” parameter we just set up.
Then in the data tab, you select the workflow (because it is of type voucher it appears)
See what happens when you try to do it on another data type …
So the bulk action will now pass each voucher in your view to the workflow where it gets updated.
It can take a while to populate the list.
It is more like “perform action on a list” than a bulk action.
And that did the trick. Thanks again @NigelG ! Hope others find this as helpful as I did.
4 Likes
Thanks @NigelG and @rendini for sharing your experience.
You guys just saved me from recreating a table with 1,500 entries.
4 Likes