It doesn’t go to index, it goes to the group ‘create-invoice’ on the index’s page (single page app navigation). I’ve made the app viewable https://bubble.io/page?name=index&id=invoicing-app1309&tab=tabs-6&subtab=General
Correct. I am not displaying them and I don’t know how to.
Right I see…
It’s really very simple - there are two ways…
- Just do a search for Invoices who’s Job is the ‘Job’ in question (this assumes that the Invoice datatype has a field for Job).
or
- Just display the Job’s Invoices (this assumes that the Job has a field for list of ‘Invoices’)
Either method will work fine (depending on how your database is set up), although the second option is probably preferable in terms of simplicity and speed/performance.
I have tried both these methods and neither work.
For ref: The Job has a field for ‘Invoices’ and Invoices has a field ‘Job’.
I am not using a list because I don’t see any advantage, invoices are displayed in RG and show multiple invoices.
I am going to try your option 1 again because I can’t recall why it didn’t work (I know I tried it though).
Option 2 wont work because I can’t display the Job’s Invoices, the invoice page is type Invoice so Bubble will not allow reference to a Job.
I do appreciate your help, sorry if I am missing the obvious but I feel I have tried everything.
I will now try your option 1 …
I tried and I get this. Note that I am referring to ‘manage-job’ which is the page that shows the users all the options for their Job (see ‘Step 2’ group in my step by step images above).
I have tried both these methods and neither work.
Trust me - either of those WILL work - if it’s not working you’re doing it wrong.
The Job has a field for ‘Invoices’
No, it doesn’t (at least not in the app you linked to above). It has a field for a single Invoice, which doesn’t make any sense and is useless, so you might as well delete that field, it’s not helping in any way here.
Option 2 wont work because I can’t display the Job’s Invoices, the invoice page is type Invoice so Bubble will not allow reference to a Job.
That literally makes no sense - you can refer to anything you need to, and if you don’t already have it referenced somewhere on he page (which you do) then just do a search to find it. There’s nothing you can’t refer to.
Ok… as I see, the problem is that I am not seeing any invoice creation during this process, so it is impossible to make references to an nonexistent invoice.
Create a state in your index page called “focused_invoice” (Type = Invoice)
During your workflow (after click in the “+” button):
Step 1: CREATE an INVOICE linked to the job
Step 2: Change the value of the state “focused_invoice” to the invoice created in step 1.
Now, when your group “create-invoice” is visible, it will show the correct invoice and you will be good to go.
It’s telling you what the issue is here: “The data you’re trying to display is a list of invoices, while it should be a single invoice”.
Now, I really don’t know what you’re doing…
I thought you were talking about displaying the invoices in a repeating group? But this is a regular group?
So I’m not sure what you’re trying to do here at all…
A regular group can only have a single ‘thing’ so you’ll need to specify which invoice you’re referring to.
But surely you’d do that from the Invoice repeating group?
So, I’m totally lost on what you’re trying to do here now.
Maybe someone else can make more sense of it.
hmm, Ok but my last big website which worked had a single invoice field and it happily displayed multiple invoices in a RG. The only reason I started from scratch was because my previous website was missing the Job data type. That said, I will try deleting it as you suggest.
You can see in the last image I posted, when I refer to Invoice’s who’s Job is the current job it asks me to refer to the first item in this list. I tried this and it meant only the first invoice displays. I got confused when trying this and so happily admit I may have done it wrong. It seems very long winded way to refer to the Job though.
Ok but my last big website which worked had a single invoice field and it happily displayed multiple invoices in a RG
Yes, it will work if you search for them (which you must have been doing), just like you can do here in this one too.
This seems like something I should try, thank you. To be clear however, the the “+” button opens the create-invoice group, but in order to save the invoice I have a save button on a floating group. That said, I think I understand your reasoning and will try your suggestion.
Correct, on the page which shows the created invoices I have a repeating group and I can simply search for the invoices related to this Job. The issue is how to create the invoice in the first place given that I am struggling to link the invoice with their parent Job. I know I’m labouring the point here so apologies.
Oh… link the Data source of your group “create-invoice” to the state “focused_invoice”.
I am 100% sure that this is going to work
I think we may be at cross wires. If a user is on their page to view all their created invoices, I am fine to display those invoices and I would (as you say) just do a search for Invoices who’s Job is the ‘Job’.
This isn’t my problem, my problem is how to show this Jobs data on the create-invoice group.
given that I am struggling to link the invoice with their parent Job
Do you mean you’re struggling to add the Job to the Invoice datatype when creating the invoice via a workflow?
If so, I really don’t get what the issue is - just set the Job field on the invoice to whatever Job you’re creating the invoice for (you can use a custom state to define that, but there’s no need as you MUST already be referring to the job elsewhere - or how would you be creating the invoice in the first place? - so just refer to that).
Ok, I am going to take a break for an hour then re-read your comments and investigate/test more. I want to avoid getting myself confused and also take time to appreciate and understand your feedback. I will update later and I’ll try and be as clear and specific as possible. Thanks @adamhholmes and @rpetribu
Will do this and report back later! Thank you
Quick update: I have now figured out how to display the customers name on the invoice.The way I did this is to think of the steps leading up to creating an invoice;
Create create Job > View all Jobs > Manage Jobs > Create invoice
The first 3 steps all have a data source of ‘Job’ and the final create-invoice group has a data source of ‘Invoice’. So, when I get to the final create-invoice step, I can no longer make use of Parent group's Job
(because the parent group is Invoice).
What I can do is reference the last group which does have a datasource of Job, which in my case is manage-jobs.
The answer to displaying the customers name on the invoice is therefore; manage-job's Job's Customer's First name
This solves that part of the larger issue. I will now continue references this page and see if I can get the full invoice set up and linked to it’s parent Job.
You can’t refer to the invoice - it doesn’t exist!
You haven’t created it yet, so of course it won’t have an associated customer.
Searching for an invoice that doesn’t exist makes no sense.
It’s the Job you need to refer to, not the invoice (there is no invoice as you haven’t created it yet).
Yes, I want to refer to the Job.
The reason for me creating this post is to ask how to refer to the Job whilst we are currently on the Invoice datatype.
Referring to the invoice would have been easy because the parent group is Invoice.
I think I have found the solution (it seems to be working) by searching a previous group which does have the Job datatype.
The next step for me is to create the invoice, then I can refer to the invoice if I need (because it will have been created). I only wanted to display the Job’s customer’s name for a nicer user experience, as a confirm that the invoice will be sent to the correct person once completed.