Forum Academy Marketplace Showcase Pricing Features

Inserting multiple items into a dynamic value from a single database query

Hi,

Is there a way to return a dynamic value from a database query that contains multiple columns?

For example:
Query Name: GetItem
SELECT Item 1, Item 2, Item 3, Item 4, FROM Items WHERE ID LIKE ? 1

Then when I go to “Insert Dynamic Data” and make the API call from the database connector using ‘GetItem’s Item 1 Item 2 Item 3 Item 4’

Right now I can only seem to enter the dynamic data “GetItem’s Item 1” for 1 item and then I have to make another query for the other 3 items.

Is there a way to do this so I can minimize the calls to the database (1 versus 4)?

Thanks for your help,
Sharon

Nevermind, I achieved what I was looking for using a repeating group with 1 column and 1 row. If there’s a better way to do this please let me know.

Thanks.

It depends what you want to do with the data after - can you describe where you’re using it?
The results of the call are cached - unless you change parameters, we used the results from the first call.

Another option is to create is an action, create a new thing to store all the fields you want in one shot, and then use the data from the thing. Actions are re-executed every time, there’s no caching.

Hi @georgeciobanu, thanks for your reply.

The parameters will change for each thing.

For your second option, if I created a new thing to store the values of each field I would want to associate it to another type/thing… but it seems like I can’t do that relational database stuff in your database like joining data types, right?

Thanks,
Sharon

It will be easier to design a solution if I understand what you’re trying to achieve. Here’s what I understand so for, with some of my comments on whether/how it is possible:

  1. You want to get some data from a database and you’d like to have several columns in one call.
    Certainly possible with your select statement (I’m not sure you need the LIKE) to return multiple columns.

  2. Whether you need to use these results as an action or data depends on what you want to do with it. Are you trying to save the data in Bubble? Create a chart? Compose an email? Describe the high-level goals of your design and we’ll gladly suggest options.

if I am understanding her question correctly, I believe I am having a similar issue. @romanmg had answered another question of mine in this thread, but which is bringing up this issue for me, as I understand it. The original thread can be found here: Can a list have multiple copies of the same entry?

leaving the link up to reference for others incase they stumble on this later.