Forum Academy Marketplace Showcase Pricing Features

Write dynamic data to SQL DB

I’m attemping to use an INSERT statement but it doesn’t appear that I can pass dynamic data through the database connector plugin. Is there anyway to write dynamic data to an external DB from within Bubble?

Thanks a lot!

Garrett

If you add parameters you should be able to define them dynamically. For instance, with mssql, you can do @name and then define a parameter name.

to Clarify, how can I pull the parameters into my statement. If i have created a bubble parameter named Test, how will I call that into my insertinto statement. Doing it as believe is only returningi a NULL value. I assume it’s not initializing correctly.

INSERT INTO iStrengthLabNew.Workout (Exercise2) VALUES (@Test);

Do you think that I need to initialize the variables at some point? I have tried multiple ways to try to pass values via variables or the parameters, and nothing is working. This is a crucial part of my app as I need to write and read lots of data and if I can’t do it this way, i’m afraid I won’t be able to do it at all.

I love Bubble so far!! Thanks a lot for your help and let me knwo if you need more info to assist.

I am using MySql also.

I “think” that mysql does it with a column “:”. For instance

select :x + :x as z

Can you try that?

@gobroady did you manage to resolve this? I’m stuck with the same thing.

Thanks

Vicky

For MySQL I got it working, like this:

In the plugin page:

insert into mytable (mycolumna, mycolumnb, mycolumnc) VALUES (?, ?, ?)

And then used the button Add Parameter three times and put appropriate names and types and test values. I think from memory that it does an actual insert with the test values.

I set the query to be used as an “Action”.

In the Workflow page:

Choose an action, Data (Things) > queryname, then put values in for all the parameters that were defined in the plugin page.

I could only get it inserting one row at a time per action this way, if someone has worked out how to insert multiple rows from a list that’d be handy!

2 Likes

Thanks so much for replying, I’ll give that a go.

Vics

That worked great, onto the next thing. Thank you.
Vics