Forum Academy Marketplace Showcase Pricing Features

Trying to populate database with tweets, wanting to use a loop like function

I am brand new to bubble and find it amazing. There are so many things I can do that I’d never be able to do otherwise, but when it comes to replicating certain things I can easily do in C++ or PHP, I am stumped.

I hope this hasn’t been asked before, I have searched forum several times to no avail.

Essentially, what I am trying to do, is grab 100 twitter users last 100 tweets (10k total). In order to get the data in, nice and clean, I have created a data type, “tweet,” which contains all the pertinent info, namely its text, created date, and fav count. The problem I’m running into is that I can do this, it’s just really not pretty. I am using a data type with one variable (a number) to increment for each tweet’s item# (this is jargon for the twitter API, but it’s just saying how far down it is along a user’s timeline, item 1 being their most recent tweet), which allows me to iterate through all 100 tweets for a user by copying and pasting 2 workflow commands, one that populates the tweet, and one that adds 1 to the variable (akin to a varName++ in C++).

Doing this with one workflow would require 300 or so steps. I find myself wondering if there’s a better, prettier way.

I have also tried creating a loop using 2 “Custom events,” but Bubble won’t seem to run them when I do this.

Thanks for your help, and let me know if you need any clarification!

The creators mentioned that it’s intentionally difficult to do loops, as all the apps are on a shared infrastructure. One poorly done loop could negatively impact all the other running apps, so there isn’t a clear way to do this at the present point in time. I would reach out to support directly for their suggestions, but I remember reading this not too long ago. I’d love to be corrected here!

1 Like

That makes total sense. Seems like there’d be a way to catch them before they cause all hell to break loose, but all in all, having to do this wouldn’t be the worst thing in the world. I am actually realizing a way to circumvent having to copy and paste so many actions would be to just string a bunch of Workflows together (since you can easily duplicate workflows).

I wonder if you could create an API workflow that held, and incremented, the count on a table.

Not sure if you can schedule a workflow from itself, but you can trigger it externally somehow.

I have successfully had Bubble looking via Zapier although Emmanuel frowned a little :slight_smile:

1 Like

Hi all,

Just wondering if there has been any elegant solutions to this.
I am taking my first go at the API Connector and just trying to work through the best way to create a list of things from the API response.

The API call I have is bringing back multiple results (from a search) and I can’t seem to figure my way through how to cycle through this list and show them in a repeating group.

Logically I think that I could create 2 workflows, one that makes the first call to get the number of results and writes that value into a custom state and a second ‘Do when condition is true’ workflow that repeats the API call and then cycles through the list creating a new thing until a counter (which is updated with each new thing created), equals the original workflows record count. Then I can show this in a repeating group.

A couple of things that I don’t like about this approach.

  1. It will doubling my number of API calls.
  2. I really just want to show the results in a repeating group to allow the user to pick one of the results and then write that single result to the table (instead of writing them all).

I’m sure there are better ways to do this (and I’m sure I’m probably missing something really fundamental and simple here).

Hoping someone has some good insight into this… :slight_smile:

Cheers
Lyndon

The API connector will happily bring bank lists for you, and they can be displayed in Repeating Groups.

You need to set to the API connector to recognise this however, so when you initialise the API you select the repeating element and then use this is the repeating group.

Can’t believe how simple that was…! :flushed: Was completely overthinking it.

Thanks Nigel for the info.