That’s not what I’m suggesting. What I am suggesting is that, when one receives a response that is a list of a compound data type, that one have the option of having Bubble create that data type in the database so that such objects, when saved, can actually be accessed.
I feel like I’ve explained this a bunch of times in different ways. The problem goes like this:
You have an API call “My API Call” that returns a list of compound data (a JSON structure). For example, an array of Events where each Event in the list (for example) has a start_date, end_date, and note.
The API Connector sees this list and retrieves it. This list becomes a data blob object that Bubble calls “My Api Call Events”. It is a list of Events and Bubble knows this once the API call is Initialized. It knows what an Event is and knows what a list of Events looks like.
We can take this data blob and attach it to some object. We do that by going into the Data tab and adding a field on some object to receive a list of that type. Here’s a real world example: I have an API that I built myself that returns a list of Events. The API call is called “iCalFromURL” and so this phantom data type (I don’t know what you call it internally – an API data type, perhaps?) becomes “iCalFromURL Event”.
In the data tab, I can now create fields of that type. Below the list of types that we have defined in our database, we find a list of API Connector-defined data types. “iCalFromURL Event” will be one of these. Here it is:
So I can make a receptacle to contain this list on some object. In my case, I put a field on my “Calendar” data type that a list of iCalFromURL Events:
Now we may have a workflow that Gets Data from API and retrieves this list via the “iCalFromURL” API call and stores it on a Calendar object.
Now that we have this, we can do things like visualize that list in a Repeating Group (for example). If Some_Calendar is an object of Calendar type, the source for such a repeating group could be “Some_Calendar’s iCal Events”.
However, this is the ONLY way to retrieve an “iCalFromURL Event” from the database. The only “handle” we have to this blob of iCal Events is via that field on Calendar objects. In Bubble terms, an “iCalFromURL Event” is neither saveable nor searchable. It is a primitive, like the integer 2. Each of these objects exists and is stored in the Bubble database, but they do not have a unique ID I guess (at least, not one that is exposed to us).
This is exceedingly strange because Bubble knows all about an “iCalFromURL Event”. In the hypothetical RG I mention above (which contains a List of iCal Events), we can show each iCal Event’s start_date, end_date, note, etc., and other fields that it has.
But we cannot search for these in the database. Neither can we modify them. Neither can we create a new iCal Event. This seems to be purely because we have no way of promoting the “iCal Event” data type up to the main database level. It resides in what I call “the API Ghetto”.
We can only operate on these (and in a very limited way) by downloading the full blob to the browser and then using list operations on them there. Once we have that list we can do all of the usual things, like select the _n_th iCal Event in the list. (e.g., Calendar’s iCal Events:item 4 – this expression resolves to a single object of iCalFromURL Event type)
We can similarly use client-side functions like :filter on this list to narrow it down.
But this object is not a Thing. We cannot make changes to it as there’s no way to select a Thing of that type. Such objects are not found in the list of Things in our app. But they exist and they are there in the database. Similarly, we cannot Create a New Thing of this type.
All we can do is grab an existing object of this type and do stuff like push it on to another list of that type.
- I might be totally wrong about this, but it seems like we shouldn’t have to iterate over a list like this and individually Create a New Thing of some parallel data type to get access to them. Why can we not just ask Bubble to “promote” the iCalFromURL Event data type to a Custom Data Type so that we can now select this data type as a search / create / make changes target?