How to assign Datatype to another Datatype?

Hi guys,

I am really struggling with this. My users can create ‘projects’ and add invoices to the project(s). Clicking on a given project should then show the invoices create ONLY for that project, but users are seeing all invoices in all projects - how can I link an invoice to a specific project?

I have created a very simply (3 page) website which shows you my set up;

You don’t have any constraints on your search for invoices (the RG’s datasource).

So how will it know which invoices to show?

That’s why it’s showing them all.

Hey Adam, I have now added a constraint to the RG’s ‘search for invoices’ but no invoice data shows up at all now. I don’t know why I’m not getting this?!

I have made the app public editable in case you had a moment to add the correct constraint. I have honestly been working on this for 2 days :frowning:

What invoice data are you expecting to show?

There’s nothing in your database that meets the search constraints…

For this dummy website I only need to show the invoice Amount (formatted as £0.00). What I am trying to work out is how to assign multiple invoices to a single Project. I can then take this knowledge over to my main (more complex) website.

You just need to set a Project field on the Invoice (or have an Invoice list field on the Project, or both).

I believe I have done that, let me check … yes, I had done both.

Yes, but you don’t have any relevant data in the database… which is why nothing is showing.

You need to create workflows that will create the data you need with the correctly assigned related fields.

Then use the appropriate constraints on your page to show the relevant data.

hmm… when you say relevant data, are you referring to saved invoice amount and saved projects? If so, there are several projects and invoices saved?

You’ve got no project data on any of the invoices… (which is why nothing is showing)

AND no invoice data on any project

I think this is what I need help with, how do I display the invoice data on a project?

Thinking about this, I suppose it would be better to display invoice data on a project (rather than vice versa) because one project may have multiple invoices.

I have tried to display invoice data on a project by using projectID’s but it never works, I can’t figure it out.

Do you mean how do you display it? Or how do you set it? (I think you mean how do you set it?..)

You just set it in your workflow, when you create the thing, the same as you would any other field - i.e. parent group’s project (or however you need to refer to the Project).

When I refer to the Project in the ‘create invoice’ workflow then no invoices show up anywhere on the site.

Screenshot 2022-02-24 162640

I had a freelancer who attempted to fix this but he couldn’t fix it either, I thought it should be easy? The last two days have been so draining trying to fix this :frowning:

You’re still not setting the project data on the invoice.

What you’ve got there doesn’t make any sense (how can you refer to the parent group’s invoice’s project, when you haven’t even created an invoice for that project yet?)

And besides, why does the parent group have a content type of Invoice? That makes no sense… surely it should have a content type of Project…

I had a freelancer who attempted to fix this but he couldn’t fix it either, I thought it should be easy? The last two days have been so draining trying to fix this :frowning:

A freelancer! Wow!! I hope you didn’t pay them!!

This really is very simple - you’re getting it completely confused and mixed up here…

All you need is to have the invoice group’s content type set to Project
The datasource on the invoice RG set to the parent group’s project’s invoices (or do a search for invoices who’s project is the parent group’s project).

And when you create a new invoice just set the Project field to the parent group’s project (and add it to the parent group’s invoice list if you have one).

That really is all there is to it.

I could set up a simple demo app in about 3 minutes - but I’m busy right now, so if I get the chance later I’ll do it so you can see how simple it should be.

In the mean time see if you can fix it by following the instructions above.


Thank you, I’ve just been trying this for another hour or two. no joy.

I’ve now set the invoice group’s content type to Project (this is the main ‘page’ group, not the RG type of content. If I then attempt to set the datasource on the invoice RG to theparent group’s project’s invoices it asks for more text (see image below). I can do a search for invoices who’s project is the parent group’s project but this failed too, basically no invoices showed up in results.

Regards the freelancer, no I didn’t pay him!

Thank you for offering to set up a simple demo, I really need that. Please can you edit my demo website rather than create a new one or I will probably get more confused!

I have been using Bubble 8 hours a day for a year (building my app) and I am clearly unable to learn effectively. I tried reading documentation on how to fix the above issue but I wasn’t able to find anything which was specific enough.

Should I use a ‘list’ for my use case? Users will be creating Project’s (such as ‘Fixing Mr Smith’s roof’ and then they will send an invoice (or multiple invoices and estimates). These invoices/estimates should remain inside the parent Project.

Ah Adam I think I have done it! I had to pass data from the Project creation to the Invoice page and then I messed around with every possible combination of content type settings.

Would you please look and see that I have done it all correctly?

I’m so annoyed with myself for having to bang keys like a monkey to find the solution, I am not understanding the basic concept of Bubble at all I guess. However, if you confirm I have set it up correctly I will study it, rebuild it, study it more until it ‘clicks’.

1 Like

Looks good to me…

Thanks a million @adamhholmes !

I created a few different versions of the dummy site and feel more comfortable with the concept. I really appreciate you taking the time to point me in the right direction!

1 Like

Unfortunately the solution didn’t work because a Job couldn’t refer to an Invoice because invoices weren’t saved in the Job’s datatype. I will keep trying. It’s super easy with a demo mock up site but doing it on my large complex site is a very different matter.