Forum Academy Marketplace Showcase Pricing Features

Join of tables (SOLVED)


I´ve three things created: customers, invoice_header and invoices_lines

What I need to know is if I can get all the lines in invoice_lines related to one customer. How do I do that?

Should I store the customer ID into the invoice_lines thing?

Thanks in advance.

1 Like

Maybe a bit technical (for me at least). Can you give it a try @emmanuel ?

Thanks a lot.

The way Bubble tends to work best is instead of storing the id (and then having to do a search) is you store the actual Customer THING on the invoice. So give the field a type of Customer. That way you don’t need to search. It is just “there”.

Do you have an “invoice” data type ?

Just guessing, but you might want to think about having an Invoice that has a list of Invoice Lines as a field.

Then the Customer has a list of Invoices as a field.


Hi @NigelG thanks for your reply,

Yes, I have an “invoice” data type, check this out:

Also, the list of something is limited, right? I guess no one would have more than 1000 invoice_lines but for sure a customer can have more than 1000 invoices.

Ah, yes, in that case you could put the customer as a data type on the invoice. Rather than the id.

And have the invoice lines as lists on the Invoice, assuming not more than 1000.

1 Like

Thanks a lot @NigelG,

That I´ll try.

In practice very few users have it the 1000-items-in-a-list limit so I wouldn’t worry too much about it. And you can always find a way that doesn’t rely on a list field to link two things.


I´m having a really hard time trying to connect invoice with invoice lines. The way that the new invoice page works right now is you select the client on the same invoice and below you have a repeating group of invoice lines with the inputs to enter the data.

The problem is that I don´t know how can I relate the invoice lines with the invoice and viceversa.

Another issue that I´m having is that whenever I create a new invoice, the invoice lines of the last one appears again.

Could you help with it?

Here is the app:

Thanks a lot.

So I think the think we need to do is to decide on the strategy for how we handle all this temporary data.

The simplest way is the create the new “Draft” invoice on entry to the page, and to add invoice lines to this as you go along.

When you do “Save Invoice” you just update a status on the invoice that says “Saved” and only then do you create the invoice number that we discussed before.

The slight downside is that you may well have “Draft” invoices hanging around if someone closes their browser.


So I have simplified it a little.

I have created a new page that creates the draft invoice, and then sends that to the page (in your page it was somehow using the current page invoice but that wasn’t set up).

Then on each invoice line add, I create the line and add it to the list on the page invoice.

The when we save we update the invoice data.

So here is an invoice with invoice lines.

And here are the lines.


Wow thanks a lot @NigelG,

It works like charm.

That´s a nice approach what you´ve done there.

Now the problem is that when the user hits on the “save invoice” button also the invoice lines related to that invoice need to be set with the status as “active”.

I´m trying to figure out how to do it right on the page you´ve created but it´s not an easy thing I´m seeing.

Do you have any idea @NigelG?

Thanks a lot.

Just solved @NigelG creating another step when saving the invoice to update the status of the lines.

Thanks a lot.

1 Like