Forum Academy Marketplace Showcase Pricing Features

Make a change to a list of existing things -linking data types

Hi my amazing Bubble friends,

I’m at my wits end with this one. (just figuring out API workflows)
I’m trying to create reading lists for my users by allowing them to select Google Book search results. (using GooglebooksAPI)
I have search boxes for users that populate a Repeating Group with Google Book search Results. each cell has an ADD button to Add BOOKS and AUTHORS to my Bubble database. (I will create a reading list from this)

  • In other words - a user does a search for Google Books and makes a selection, this adds the book and author to my Bubble database (if they don’t already exist).

Simplest list of Objectives.

  1. Add the selected book to the Bubble database if it does not exist. (datatype Book)
  2. Add the Author(s) to the Bubble database if it does not exist. (datatype Authors) - a book can have many Authors.
  3. Cross reference the Books and Author(s) datatypes. (link them in the database to each other)
    -Books datatype has a refAuthors link (which is a list), and Authors datatype has a refBooks link. (also a list)

I’m able to accomplish all 3 objectives above using “schedule API workflow on a list” if and only if the Book and Author(s) do not exist before the workflow is run.
It works because I can use the results from Step 1 (resulting Book) and Step 2 (resulting Author(s)) of the workflow, in Step 3.

((i.e. create the Book record in step 1, and the Author(s) record(s) in step 2. and then use the results from Step 1 or Step 2 to modify data in Books and Authors to create the links between the two.))

BUT, to avoid creating duplicates in Step 1 and 2 – in case another user comes along and selects the same book from Google Books – both Step 1 and Step 2 only run of the Book or Author(s) are not already in my Bubble database. If the items already exist in the database, Step1 and 2 produce no results.

I can’t figure out how to create the table links for items that existed in the database before the workflow was run.

-I’m happy to provide a read only link to the App - but, *gulp - I don’t know how to.:open_mouth:

thank you one and all for any help.


Just use a ‘make changes to Book’ action if the book already exists…

It might be simpler to run that as a separate workflow, with a conditional on the workflow itself (rather than as another action in the same workflow)…

Just make changes to the book to add the authors, then make changes to the list of authors to add the book (assuming that’s what you’re trying to do here).

Thanks for the response, and I’m sure it’s something simple like this, but…

I’ve been trying to figure out for 3 days now - how to filter the existing Authors data type (so I only make changes to the Authors in the Google Book Search results.)
When doing a Google Books search, the Author(s) are displayed as text. If there are multiple authors they are separated by commas.

I can’t figure out how to do a search for my items in my bubble data type “Authors,” if there is more than one, using the comma separated text values in the Google Search results, -the Constraint, or Filter, always ends up blank. (if there only one Author, both “contains” returns the Author’s name.) - Am I right on thinking this is matching items in a list to items in another list? (guess I don’t know how to do that.)

Okay, breath… . - I’ve managed to find the solution for this.
It was difficult to weave through all the variables, Lists vs Things, data types vs datatypes within other datatypes (Authors within the Books Type, and Books within the Author type,) and running a workflow on individual items within a list (adding the book to all the individual Author items).

Ultimately there are 4 workflows, 2 front end and 2 backend (API on a list).
Front end

  1. Workflow for new books.
  2. Workflow for existing books.

Backend workflows on APIS. (These exist within both front end workflows)

  1. API Workflow on a list of new Authors.
  2. API Workflow on a list of existing Authors.
    The linking of Authors and Books all happens within the API Backend workflows.
  • thanks again Adam
    If anyone reads this and thinks a deeper explanation would be helpful - hit me up!