Here’s the question: WHERE does this “Activities” table you have come from?
It’s not some other table, it’s a data type (I know you call these “tables” and that nomenclature isn’t incorrect in a sense) that is IN YOUR APP.
You created it, right? By iterating over the response from your API to essentially (in a very slow Bubbly way) flatten those nested parameters. Right?
You went from this:
To this:
Like you said in your first detailed response (which I greatly appreciate, by the way): “One way to populate these values is to flatten them into one table in the database.”
But that’s not a single-step operation. You had to loop over those lists (of “toRecipients” and “replyTo” lists) using an “API Workflow on a List”, correct?
I know this can be done. It’s just horribly, horribly not performant.
Of course, sometimes that’s acceptable. But in general, since Bubble really, really discourages iteration anything that can be done to avoid it is a plus.
My point is that WE SHOULDN’T HAVE TO DO THIS in this way. Over time, the added time to do this becomes huge. When really, API Connector should have a flattening option that can execute in a real server-side loop and just flatten required stuff in ms, rather than minutes.
The other thing I think you’re missing is that YOU DON’T have to do what you’re doing – IF YOU’RE WILLING TO LIVE WITH or work around certain problems.
For example, if you just took the return values for your API such as “toRecipients” list and “replyTo” list and shoved them into a field on Activity without flattening, you’d still be able to READ them just fine. You just wouldn’t be able to manipulate them directly “in situ” as it were.
An item in the “toRecipients” list would be like:
{“emailAddress name”: “Keith C.”, “emailAddress address”: “keith@synth.biz”}
And that thing would be of type “toRecipients”. It would be one of those “API Ghetto” types. You wouldn’t be able to make new ones, etc. But you read 'em just fine and even flatten “on the page” should your interface need to add other recipients. (Basically, you promote them to full data type things as you need them, rather than in bulk via an API workflow on a list.)
The deal with MY complex data type that comes back is that is slightly different than name/email address pairs. There’s more fields (more data to flatten/promote in each iteration = more slow), and I ping that API pretty frequently. And I kinda depend/expect a rather quick response from the API and I have interface elements (live calendars) that need the data quickly.
So I don’t really have time to wait for an artificially throttled API Workflow on a List to complete.
Here’s the thing that’s driving me crazy:
The way these lists come back is ACTUALLY perfectly fine for me. With the NOTABLE EXCEPTION that the DATA TYPE ITSELF is not accessible in the same way as user-created data type. THAT’s what causes the problems for me.