How should I correctly setup a multi-insert workflow (screenshot included)?

Hey all,

Again, learning how to do things the Wappler way instead of the Bubble way.

Right now, I’d like to create a two records each in a different table, that are linked to each other.

In Bubble, what I did was a simple 3 step workflow that created record 1 (dB insert) > create record 2 (db Insert) > Update Record 1 with a link to record 2 (dB update).

The logical way for me to do this in Wappler, was a similar flow to that in Bubble - but I’m getting errors, this is the screenshot of how I’ve set this up.

Screen Shot 2020-07-10 at 2.09.13 pm

It looks like I have to unlearn a lot of the way Bubble does things, do do them properly in Wappler - which I’m enjoying, just with limited documentation it’s a little harder to find my way there on my own.

What is this link you’re referring to in step 3? Is it just updating the first DB insert with the ID field generated in step 2 when you insert into your lead ‘create lead form’ table?

Hi @Philip_J

So step 1 inserts a new pitch,
Step two inserts a new lead form and links the lead form to step 1
Step three updates the record created in step 1 with the lead form from step 2.

So table 1 is then linked to table 2, and table 2 is linked back to table 1.

Ok, so in my mind, in step 2 when you are linking the data from table 2 to table 1 (the lead form to the pitch) you would only need to update a ‘lead_ID’ column that sits in your ‘pitch’ DB?

If that’s the case for step 2, you could do that by choosing the ‘identity’ field from the output of step 1 in the dynamic bindings in step 2 (you may already know this as i saw you spoke about it relation to security IDs)

You could do an update in a similar fashion using the identity created in Step 2.

I’m not sure if this helps, but its how i interpret the issue. Also, this may only work if you have auto-incremented ID fields, i don’t know if that’s true, but all my DB tables have them so I don’t know otherwise.

1 Like

Thanks @Philip_J - this is what I have done, step 1 and 2 are ‘outputs’ so I can pick up the identity as you described above - but I’m getting 500 errors. Each ID does also have incremental property.

From my screenshot, you feel this is the right way to do multiple database actions in one workflow? E.g. Server Connect > dB Insert > dB Insert > dB Update is an OK thing to do and should work?

I’m no expert, but i had done that before with 2 steps like you said. I also just created the flow now with a 3rd update step but i didn’t execute it. It looked right though.

Any more info from chrome on that 500 error?

Ok, well that’s a good thing that I’m trying to do it the right way! Here is the 500:

  1. message: “Undefined binding(s) detected when compiling UPDATE. Undefined column(s): [id] query: update “pitch” set “lead_form” = ? where “id” = ?”

Mmm. That does look like there is an error somewhere in how it’s been set up… Does it work just the first 2 steps?

Yep step 1 and 2 are working great, it is just oddly failing on the update action, especially as i’m following the exact same procedure as step 1 and 2 for linking.

Got it! I had not used the condition tab in step 3 to make sure I was updating the pitch record from step 1 - I just assumed it would know which record it was updating as it was in the same flow!

Excellent. It did look like that error message had an issue with the condition, just hard to tell when you can’t see the data :grin:

Glad it’s working

1 Like

Thank you for your help! Much appreciated! :slight_smile: